Need assistance with creating a Stochastic Momentum Index (SMI) scanner that shows when "SMI", not "AvgSMI" is overbought (+ 70) and oversold (- 70). Thank you!
declare lower;
plot SMI = StochasticMomentumIndex()."SMI";
plot AvgSMI = StochasticMomentumIndex()."AvgSMI";
plot OverBought = 70;
plot OverSold = -70;
plot zeroline = 0 ;
zeroline.SetPaintingStrategy(PaintingStrategy.DASHES);
def signalUp = AvgSMI[1] < oversold and SMI[1] < AvgSMI[1] and SMI > AvgSMI;
def signalDn = AvgSMI[1] > overbought and SMI[1] > AvgSMI[1] and SMI < AvgSMI;
plot Up = if signalUp then AvgSMI else double.NaN ;
Up.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Up.SetDefaultColor(color.green) ;
Up.SetLineWeight(5);
plot Down = if signalDn then AvgSMI else double.NaN ;
Down.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Down.SetDefaultColor(color.red) ;
Down.SetLineWeight(5);
AddCloud(SMI, AvgSMI, color.light_green, color.pink);
AddChartBubble(signalUp, 0, close, Color.light_orange, no);
AddChartBubble(signalDn, 0, close, Color.light_orange, no);
# ########################################################
declare lower;
plot SMI = StochasticMomentumIndex()."SMI";
plot AvgSMI = StochasticMomentumIndex()."AvgSMI";
plot OverBought = 70;
plot OverSold = -70;
plot zeroline = 0 ;
zeroline.SetPaintingStrategy(PaintingStrategy.DASHES);
def signalUp = AvgSMI[1] < oversold and SMI[1] < AvgSMI[1] and SMI > AvgSMI;
def signalDn = AvgSMI[1] > overbought and SMI[1] > AvgSMI[1] and SMI < AvgSMI;
plot Up = if signalUp then AvgSMI else double.NaN ;
Up.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Up.SetDefaultColor(color.green) ;
Up.SetLineWeight(5);
plot Down = if signalDn then AvgSMI else double.NaN ;
Down.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Down.SetDefaultColor(color.red) ;
Down.SetLineWeight(5);
AddCloud(SMI, AvgSMI, color.light_green, color.pink);
AddChartBubble(signalUp, 0, close, Color.light_orange, no);
AddChartBubble(signalDn, 0, close, Color.light_orange, no);
# ########################################################