Conversion of Jurik Filter from mq4
Forums › ProRealTime English forum › ProBuilder support › Conversion of Jurik Filter from mq4
- This topic has 11 replies, 5 voices, and was last updated 3 years ago by Patrick K Templar.
-
-
01/04/2019 at 4:37 PM #88002
Hi Nicolas,
Found this forum that is dedicated to Jurik tools https://www.forexfactory.com/showthread.php?t=696822 , it would be great if you could add to our arsenal those tools. For a start here the Jurik Filter
rgds
01/05/2019 at 11:47 PM #8805101/07/2019 at 8:32 AM #88081These 2 versions of the Jurik moving average could help:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950//----------------------------//// JMA - Jurik Moving Average ////----------------------------//Period = 20Period = MAX(Period, 1)// Pow = 5 ({ 1..10 })// R = 1.5 ({0.5..2.5})Pow = 4R = 1beta = 0.45 * (Period - 1) / (0.45 * (Period - 1) + 2)IF Pow = 1 THENalpha = betaELSIF Pow = 2 THENalpha = beta * betaELSIF Pow = 3 THENalpha = beta * beta * betaELSIF Pow = 4 THENalpha = beta * beta * beta * betaELSIF Pow = 5 THENalpha = beta * beta * beta * beta * betaELSIF Pow = 6 THENalpha = beta * beta * beta * beta * beta * betaELSIF Pow = 7 THENalpha = beta * beta * beta * beta * beta * beta * betaELSIF Pow = 8 THENalpha = beta * beta * beta * beta * beta * beta * beta * betaELSIF Pow = 9 THENalpha = beta * beta * beta * beta * beta * beta * beta * beta * betaELSIF Pow = 10 THENalpha = beta * beta * beta * beta * beta * beta * beta * beta * betaENDIFIF BarIndex = 0 THENFilt0 = SeriesFilt1 = SeriesAFR = SeriesELSEFilt0 = (1 - alpha) * Series + alpha * Filt0[1]Det0 = (Series - Filt0[0]) * (1 - beta) + beta * Det0[1]Filt1 = Filt0[0] + R * Det0[0]Det1 = (Filt1[0] - AFR[1]) * ((1 - alpha) * (1 - alpha)) + (alpha * alpha) * Det1[1]AFR = AFR[1] + Det1[0]ENDIFRETURN AFR1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950//-----------------------------------------------------//// JMA - Jurik Moving Average (Responsiveness Version) ////-----------------------------------------------------//Period = 20Period = MAX(Period, 1)// Pow = 5 ({ 1..10 })// R = 1.5 ({0.5..2.5})Pow = 5R = 1beta = 0.45 * (Period - 1) / (0.45 * (Period - 1) + 2)IF Pow = 1 THENalpha = betaELSIF Pow = 2 THENalpha = beta * betaELSIF Pow = 3 THENalpha = beta * beta * betaELSIF Pow = 4 THENalpha = beta * beta * beta * betaELSIF Pow = 5 THENalpha = beta * beta * beta * beta * betaELSIF Pow = 6 THENalpha = beta * beta * beta * beta * beta * betaELSIF Pow = 7 THENalpha = beta * beta * beta * beta * beta * beta * betaELSIF Pow = 8 THENalpha = beta * beta * beta * beta * beta * beta * beta * betaELSIF Pow = 9 THENalpha = beta * beta * beta * beta * beta * beta * beta * beta * betaELSIF Pow = 10 THENalpha = beta * beta * beta * beta * beta * beta * beta * beta * betaENDIFIF BarIndex = 0 THENFilt0 = SeriesFilt1 = SeriesAFR = SeriesELSEFilt0 = (1 - alpha) * Series + alpha * Filt0[1]Det0 = (Series - Filt0[0]) * (1 - beta) + beta * Det0[1]Filt1 = Filt0[0] + R * Det0[0]Det1 = (Filt1[0] - AFR[1]) * ((1 - alpha) * (1 - alpha)) + (alpha * alpha) * Det1[1]AFR = AFR[1] + Det1[0]ENDIFRETURN AFRYou can adjust the “Period”, “Pow” and “R” values directly into the code.
01/07/2019 at 9:38 AM #8808501/07/2019 at 10:55 AM #88092Should line 35 not have one more * Beta?
I think you are right, codes taken from this indi: Average Filter Regression
Perhaps also using a loop would be better way to calculate alpha?
A more classy way for sure, but not sure about performance.
01/07/2019 at 11:51 AM #88096A more classy way for sure, but not sure about performance.
Yes loops are a much neater solution but they can make things a bit slow and I guess if the Pow only needs to be set to something between 1 and 10 then repetitive typing is the way to go.
Maybe when I have more time I will do a comparison speed test!
01/10/2019 at 11:08 PM #8834501/11/2019 at 10:57 AM #88374The flat section you see is because this indicator is multiple timeframe and plot the superior timeframes values of that moving average.
ProBuilder is not MTF compatible, but the code I gave you above is similar to the MT4 version on the same timeframe.
01/11/2019 at 11:54 AM #8837901/22/2020 at 10:29 AM #117496Hi, Thank you Nicolas for this code.
If you want use a calculation of power inside PRT code it is very simply and not necessary to use condition “If” heavy and longer.
So you can remplace ligne 16 to 36 by just one line: So no limit of power and code very light.falpha = exp ( Pow * log(fbeta) )
Explanation:
A (power x) = exponential (x *natural logarithm (A)) [natural logarithm = “logarithme népérien” in French)
It is only mathematical property, I have nothing invented. (LOL)
01/22/2020 at 10:36 AM #11749711/21/2020 at 2:14 AM #151111I get a syntax error the following variable is undefined series
-
AuthorPosts
Find exclusive trading pro-tools on