Jurik Moving Average

#11
Hi Columbus,

I tried working out on HMA, it seems quick.
However, I am not sure how it works in range bound market.

It 'd be good if we can backtest it.

I got the following comparison from Hull's website.

I think if we keep SMA and HMA crossover as our entry/exit point, maybe it ll result in good trade.

However, it seems give an approximated(exaggerated) value.
Maybe that ll help in trendy market, but could result in whipsaws.

Regards
Yogesh
 
#12
Code:
function JurikMA(src, length, phase, power)
{
src = (High + Low + Close)/3;
phaseRatio = IIf(phase < -100, 0.5, IIf(phase > 100, 2.5, (phase / 100) + 1.5));
beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2);
alpha = beta ^ power;
jma = 0.0;
e0 = 0.0;
e1 = 0.0;
e2 = 0.0;

    for (i = 1; i < BarCount; i =i+1)
        {
            e0[i] = (1 - alpha[i]) * src[i] + alpha[i] * nz(e0[i-1]);
            e1[i] = (src[i] - e0[i]) * (1 - beta[i]) + beta[i] * nz(e1[i-1]);
            e2[i] = (e0[i] + phaseRatio[i] * e1[i] - nz(jma[i])) * ((1 - alpha[i]) ^ 2) + (alpha[i] ^ 2) * nz(e2[i-1]);
            result[i] = e2[i] + nz(jma[i]);
        }
        
    return result;
}
This is my code for Jurik Moving Average. The problem is it's neither giving any error nor any output. How this issue can be fixed? Please help. Regards.
 

Similar threads