Request: Ehlers Deycler (from TradingView)
Forums › ProRealTime English forum › ProBuilder support › Request: Ehlers Deycler (from TradingView)
- This topic has 5 replies, 3 voices, and was last updated 2 months ago by
Trianenn.
Viewing 6 posts - 1 through 6 (of 6 total)
-
-
07/07/2024 at 7:35 PM #234906
Hello,
I’m trying to convert this Ehlers Deycler indicator from TradingView but I can’t seem to get it work.
Here is my code:
123456789101112131415161718192021222324// Input parameterslength = 60src = close// Constantsonce PI = 3.141592653589793// VariablesPIx2Length = 2 * PI / lengthcosValue = cos(PIx2Length)alpha = 0If (cosValue <> 0) thenalpha = (cosValue + sin(PIx2Length) - 1) / cosValueelseIf (barindex > 1) thenalpha = alpha[1]endifendifdecycler = alpha / 2 * (src + src[1]) + (1 - alpha) * decycler[1]// Plotting the Decyclerreturn decycler AS "Decycler"I would appreciate if someone could point me to my mistake(s).
07/08/2024 at 6:26 AM #23490807/08/2024 at 6:28 AM #23490907/08/2024 at 6:33 AM #23491007/08/2024 at 10:55 AM #234931You only have to convert radians to degrees.
123PIx2Length=2*PI/lengthtransf = PIx2Length*360/(2*PI)cosine=COS(transf)PRT works with degrees and TV works with radians. Here you have the code:
1234567891011121314151617181920212223242526272829303132333435363738//-----Inputs------------------------------------//length=60src=closecolorMA=1//-----------------------------------------------////-----Moving average calculation----------------//once PI = 3.14159265359if barindex > length thenPIx2Length=2*PI/lengthtransf = PIx2Length*360/(2*PI)cosine=COS(transf)alpha=0if cosine<>0 thenalpha=(cosine+sin(transf)-1)/cosineelsealpha=alpha[1]endifMA=0MA=alpha/2*(src+src[1])+(1-alpha)*MA[1]//-----------------------------------------------////-----Color MA configuration--------------------//if colorMA thenif MA>MA[1] thenr=0g=255elsif MA<MA[1] thenr=255g=0endifendifendifreturn MA as "Decycler" coloured(r,g,0)style(line,2)07/08/2024 at 11:48 AM #234938 -
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)