#basically ATR based through detector - when range of the move compresses it shows that
declare lower;
input length = 21;
input through=0.8;
def trSum = Sum(TrueRange(high, close, low), length);
plot Startuptrend = if trSum == 0 then 0 else Sum(AbsValue(high - low[1]), length) / trSum;
plot pthrough=through;pthrough.setdefaultColor(color.VIOLET);pthrough.setLineWeight(2);
plot avg=expaverage(startuptrend,6);
plot crossup=if avg crosses above pthrough then avg else double.nan;
crossup.setpaintingStrategy(paintingStrategy.ARROW_UP);
Startuptrend.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Startuptrend.DefineColor("Positive and Up", Color.GREEN);
Startuptrend.DefineColor("Positive and Down", Color.DARK_GREEN);
Startuptrend.DefineColor("Negative and Down", Color.RED);
Startuptrend.DefineColor("Negative and Up", Color.DARK_RED);
Startuptrend.AssignValueColor(if Startuptrend >= 0 then if Startuptrend > Startuptrend[1] then Startuptrend.Color("Positive and Up") else Startuptrend.Color("Positive and Down") else if Startuptrend < Startuptrend[1] then Startuptrend.Color("Negative and Down") else Startuptrend.Color("Negative and Up"));