@Jim Klopp
Tried this... but the pointers look weird. Anyone can assist... to improve.
======================
declare lower;
def data = if close > close[1] then close - Min(close[1], low) else if close < close[1] then close - Max(close[1], high) else 0;
plot AccDist = TotalSum(data);
AccDist.SetDefaultColor(GetColor(1));
def price = accdist;
input deviations = 1.68;
input fullRange = Yes;
input length = 20;
input widthOfChannel = 80.0;
plot MiddleLR;
if (fullRange)
then {
MiddleLR = InertiaAll(price);
} else {
MiddleLR = InertiaAll(price, length);
}
def dist = HighestAll(AbsValue(MiddleLR - price)) * (widthOfChannel / 100.0);
plot UpperLR = MiddleLR + dist;
plot LowerLR = MiddleLR - dist;
def upsign = price <= LowerLR ;
def downsign = price >= UpperLR ;
plot signalup = upsign;
signalup.SetDefaultColor(Color.White);
signalup.SetPaintingStrategy(PaintingStrategy.POINTS);
plot signaldown = downsign;
signaldown.SetDefaultColor(Color.Red);
signaldown.SetPaintingStrategy(PaintingStrategy.POINTS);