spartan.ts
Member
Hey everyone! I've recently learned about the Jurik MA and its use within the institutional world. Wondering if anyone has used it and their experiences/thoughts with it.
The formula seems to be a secret but some have tried to decode it. Here is a few good blogs in attempt to define/reveal calculations.
https://c.mql5.com/forextsd/forum/164/jurik_1.pdf
https://regtrading.com/the-real-jurik-moving-average-jma/
Everget on TradingView has attempted a variation which I tried to convert it to TOS (below) but it's plotting displaced lower on chart. Any help would be appreciated.
https://www.tradingview.com/v/nZuBWW9j/
input length = 7;
input phase = 50;
input power = 2;
input src = close;
#input highlightMovements = YES;
script nz {
input data = 0;
def ret_val = if IsNaN(data) then 0 else data;
plot return = ret_val;
}
def phaseRatio = if phase < -100 then 0.5
else if phase > 100 then 2.5
else phase / 100 + 1.5;
def beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2);
def alpha = Power(beta, power);
def jma = 0.0;
def e0 = (1 - alpha) * src + alpha * nz(e0[1]);
def e1 = (src - e0) * (1 - beta) + beta * nz(e1[1]);
def e2 = (e0 + phaseRatio * e1 - nz(jma[1])) * Power(1 - alpha, 2) + Power(alpha, 2) * nz(e2[1]);
def e3 = e2 + nz(jma[1]); ## this is supposed to be a reassignment of value
plot jmaPlot = e3;
jmaPlot.DefineColor("Up", GetColor(1));
jmaPlot.DefineColor("Down", GetColor(0));
jmaPlot.AssignValueColor(if jmaPlot > jmaPlot[1] then jmaPlot.Color("Up") else jmaPlot.Color("Down"));
The formula seems to be a secret but some have tried to decode it. Here is a few good blogs in attempt to define/reveal calculations.
https://c.mql5.com/forextsd/forum/164/jurik_1.pdf
https://regtrading.com/the-real-jurik-moving-average-jma/
Everget on TradingView has attempted a variation which I tried to convert it to TOS (below) but it's plotting displaced lower on chart. Any help would be appreciated.
https://www.tradingview.com/v/nZuBWW9j/
input length = 7;
input phase = 50;
input power = 2;
input src = close;
#input highlightMovements = YES;
script nz {
input data = 0;
def ret_val = if IsNaN(data) then 0 else data;
plot return = ret_val;
}
def phaseRatio = if phase < -100 then 0.5
else if phase > 100 then 2.5
else phase / 100 + 1.5;
def beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2);
def alpha = Power(beta, power);
def jma = 0.0;
def e0 = (1 - alpha) * src + alpha * nz(e0[1]);
def e1 = (src - e0) * (1 - beta) + beta * nz(e1[1]);
def e2 = (e0 + phaseRatio * e1 - nz(jma[1])) * Power(1 - alpha, 2) + Power(alpha, 2) * nz(e2[1]);
def e3 = e2 + nz(jma[1]); ## this is supposed to be a reassignment of value
plot jmaPlot = e3;
jmaPlot.DefineColor("Up", GetColor(1));
jmaPlot.DefineColor("Down", GetColor(0));
jmaPlot.AssignValueColor(if jmaPlot > jmaPlot[1] then jmaPlot.Color("Up") else jmaPlot.Color("Down"));
Last edited: