Would love to see this make it to the ToS tool box, feel like it could give the McGinley ribbon a run for its money if anyone feels like converting it for the community. Appreciate anyone willing to commit to it
https://www.tradingview.com/v/pM6FkCHY/
CSS:
#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © ChuckBanger
#Request from https://usethinkscript.com/ memeber
#study("Jurik Moving Average Crossover Strategy [ChuckBanger]", shorttitle="JMAC CB"
# Converted by Sam4Cok@Samer800 - 09/2022
### Inputs ######
input ShowBand = yes;
input MidLineSignal = yes;
input ShowFastLine = no;
input length = 30; # "Length"
input phase = 0; # "Phase"
input power = 2; # "Power"
input src = close; # "Source"
input highlight = yes; # "Highlight Up/Down"
def atrLength = 30; # "ATR Length"
def mult = 1.5; # "ATR Multiplyer"
def fastLength = 5; # "Fast Length"
def fastPhase = 100; # "Fast Phase"
def fastPower = 2; # "Fast Power"
def na = Double.NaN;
script nz {
input data = close;
input repl = 0;
def ret_val = if isNaN(data) then repl else data;
plot return = ret_val;
}
#calc_jma(_src, _length, _phase, _power) =>
script calc_jma {
input _src = close;
input _length = 0;
input _phase = 0;
input _power = 0;
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 e0; def e1; def e2; def jma;
e0 = (1 - alpha) * _src + alpha * nz(e0[1]);
e1 = (_src - e0) * (1 - beta) + beta * nz(e1[1]);
e2 = (e0 + phaseRatio * e1 - nz(jma[1])) *
power(1 - alpha, 2) + power(alpha, 2) * nz(e2[1]);
jma = e2 + nz(jma[1]);
plot return = jma;
}
def jma = calc_jma(src, length, phase, power);
def jmaColor = if highlight then if jma > jma[1] then 1 else -1 else 0;
plot jmaLine = jma;
jmaLine.SetLineWeight(2);
jmaLine.AssignValueColor( if jmaColor > 0 then CreateColor(0,188,212) else
if jmaColor < 0 then CreateColor(136,14,79) else
CreateColor(33,150,243));
def atr_ = atr(Length = atrLength);
def upper = jma + (atr_ * mult);
def lower = jma - (atr_ * mult);
plot BandUp = upper;
BandUp.SetDefaultColor(CreateColor(33,150,243));
BandUp.SetHiding(!ShowBand);
plot BandLo = lower;
BandLo.SetDefaultColor(CreateColor(33,150,243));
BandLo.SetHiding(!ShowBand);
def fastJma = calc_jma(src, fastLength, fastPhase, fastPower);
plot fastJmaLine = fastJma;
fastJmaLine.SetDefaultColor(Color.GRAY);
fastJmaLine.SetHiding(!ShowfastLine);
plot cross = if (fastJma crosses jma) then jma else na;
cross.SetPaintingStrategy(PaintingStrategy.POINTS);
cross.SetDefaultColor(Color.ORANGE);
cross.SetLineWeight(2);
cross.SetHiding(!MidLineSignal);
plot CrossDn = if (fastJma crosses below upper) then (upper + (atr_/4)) else na;# style=plot.style_circles, linewidth=5, color=color.red, title='JMA Upper crossunder', transp=0)
crossDn.SetPaintingStrategy(PaintingStrategy.POINTS);
crossDn.SetDefaultColor(Color.RED);
crossDn.SetLineWeight(5);
plot CrossUp = if (fastJma crosses above lower) then (lower - (atr_/4)) else na;
crossUp.SetPaintingStrategy(PaintingStrategy.POINTS);
crossUp.SetDefaultColor(Color.LIME);
crossUp.SetLineWeight(5);
Last edited: