here's the think script code
input AtrMult = .7;
input nATR = 4;
input AvgType = AverageType.HULL;
input PaintBars = yes;
input showsignals = yes;
#def
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = HL2 + (AtrMult * ATR);
def DN = HL2 + (-AtrMult * ATR);
def ST = if close < ST[1] then UP else DN;
def Vinculum = ST;
def plotlong = if ST crosses below close then 1 else 0;
def plotshort = if ST crosses above close then 1 else 0;
plots
plot x = plotlong;
Alert (plotlong, Sound.Ring);
x.SetPaintingStrategy(paintingStrategy = PaintingStrategy.BOOLEAN_ARROW_UP);
AssignPriceColor(if x then Color.WHITE else Color.CYAN);
plot y = plotshort;
Alert (Vinculum, Sound.Ring);
y.SetPaintingStrategy(paintingStrategy = PaintingStrategy.BOOLEAN_ARROW_DOWN);
AssignPriceColor(if x then Color.CYAN else Color.WHITE);
x.AssignValueColor(if close < ST then Color.RED else Color.CYAN);
AssignPriceColor(if PaintBars and close < ST
then Color.RED
else if PaintBars and close > ST
then Color.GREEN
else Color.CURRENT);
x.SetHiding(!showsignals);
y.SetHiding(!showsignals);
def ATR1 = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP1 = HL2 + (AtrMult * ATR1);
def DN1 = HL2 + (-AtrMult * ATR1);
def ST1 = if close < ST[1] then UP1 else DN1;
def trendChangeUp = ST1 crosses above ST[1];
def closeHigherAfterTrendChange = close > open and close[1] > open[1];
def trendIsUp = ST1 > ST[1];
plot BuySignal = trendChangeUp and closeHigherAfterTrendChange and trendIsUp;
BuySignal.SetPaintingStrategy(PaintingStrategy.BOO LEAN_ARROW_UP);
BuySignal.SetDefaultColor(Color.GREEN);
BuySignal.SetLineWeight(2);
##### down #####
def ATR2 = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP2 = HL2 + (AtrMult * ATR2);
def DN2 = HL2 + (-AtrMult * ATR2);
def ST2 = if close > ST[1] then dn2 else up2;
def trendChangedn = ST2 crosses below ST[1];
def closelowerAfterTrendChange = close < open and close[1] < open[1];
def trendIsdn = ST2 < ST[1];
plot BuySignal1 = trendChangedn and closelowerAfterTrendChange and trendIsdn;
BuySignal1.SetPaintingStrategy(PaintingStrategy.BO OLEAN_ARROW_down);
BuySignal1.SetDefaultColor(Color.red);
BuySignal1.SetLineWeight(2);

Comment