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
[img]https://www.forexfactory.com/attachment.php?attachmentid=2466564&stc=1&thumb=1&d=1504476438[/img]
rgds
Noticed that there is a newer version that solved some bug
These 2 versions of the Jurik moving average could help:
//----------------------------//
// JMA - Jurik Moving Average //
//----------------------------//
Period = 20
Period = MAX(Period, 1)
// Pow = 5 ({ 1..10 })
// R = 1.5 ({0.5..2.5})
Pow = 4
R = 1
beta = 0.45 * (Period - 1) / (0.45 * (Period - 1) + 2)
IF Pow = 1 THEN
alpha = beta
ELSIF Pow = 2 THEN
alpha = beta * beta
ELSIF Pow = 3 THEN
alpha = beta * beta * beta
ELSIF Pow = 4 THEN
alpha = beta * beta * beta * beta
ELSIF Pow = 5 THEN
alpha = beta * beta * beta * beta * beta
ELSIF Pow = 6 THEN
alpha = beta * beta * beta * beta * beta * beta
ELSIF Pow = 7 THEN
alpha = beta * beta * beta * beta * beta * beta * beta
ELSIF Pow = 8 THEN
alpha = beta * beta * beta * beta * beta * beta * beta * beta
ELSIF Pow = 9 THEN
alpha = beta * beta * beta * beta * beta * beta * beta * beta * beta
ELSIF Pow = 10 THEN
alpha = beta * beta * beta * beta * beta * beta * beta * beta * beta
ENDIF
IF BarIndex = 0 THEN
Filt0 = Series
Filt1 = Series
AFR = Series
ELSE
Filt0 = (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]
ENDIF
RETURN AFR
//-----------------------------------------------------//
// JMA - Jurik Moving Average (Responsiveness Version) //
//-----------------------------------------------------//
Period = 20
Period = MAX(Period, 1)
// Pow = 5 ({ 1..10 })
// R = 1.5 ({0.5..2.5})
Pow = 5
R = 1
beta = 0.45 * (Period - 1) / (0.45 * (Period - 1) + 2)
IF Pow = 1 THEN
alpha = beta
ELSIF Pow = 2 THEN
alpha = beta * beta
ELSIF Pow = 3 THEN
alpha = beta * beta * beta
ELSIF Pow = 4 THEN
alpha = beta * beta * beta * beta
ELSIF Pow = 5 THEN
alpha = beta * beta * beta * beta * beta
ELSIF Pow = 6 THEN
alpha = beta * beta * beta * beta * beta * beta
ELSIF Pow = 7 THEN
alpha = beta * beta * beta * beta * beta * beta * beta
ELSIF Pow = 8 THEN
alpha = beta * beta * beta * beta * beta * beta * beta * beta
ELSIF Pow = 9 THEN
alpha = beta * beta * beta * beta * beta * beta * beta * beta * beta
ELSIF Pow = 10 THEN
alpha = beta * beta * beta * beta * beta * beta * beta * beta * beta
ENDIF
IF BarIndex = 0 THEN
Filt0 = Series
Filt1 = Series
AFR = Series
ELSE
Filt0 = (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]
ENDIF
RETURN AFR
You can adjust the “Period”, “Pow” and “R” values directly into the code.
Should line 35 not have one more * Beta?
Perhaps also using a loop would be better way to calculate alpha?
Should 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.
A 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!
Thanks Vonasi, Nicolas
However I think that the .mq4 filter is not simply the Jurik moving average that you posted, the plot does not have the strai9ght flat sections showed in the chart.
Am I missing something?
rgds
The 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.
WolfParticipant
Average
Hi, 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)
Thank you @Wolf. We are used to use this Math Pow version also in some other codes! 🙂
A new instruction for POW is in the pipe and should be added very soon in version 11.
I get a syntax error the following variable is undefined series