This indicator plots a dot when the current bar close above the high of the previous bar or when the current bar closes below the low of the previous bar. However this can be sloppy when in a trading range or consolidation. I am asking for suggestion on how to make this indicator better. I am not a coder, so feel free to modify the code. Thanks for your time, it is much appreciated.
Ruby:
def CloseAbove;
def CloseBelow;
If close > high[1] and !CloseAbove[1] {
CloseAbove = low - TickSize();
CloseBelow = 0;
} else If close < low[1] and !CloseBelow[1] {
CloseAbove = 0;
CloseBelow = high + TickSize();
} else {
CloseAbove = CloseAbove[1];
CloseBelow = CloseBelow[1];
}
plot CloseAbovePlot = if CloseAbove and !CloseAbove[1] then CloseAbove else Double.NaN;
CloseAbovePlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
CloseAbovePlot.AssignValueColor(Color.black);
plot CloseBelowPlot = if CloseBelow and !CloseBelow[1] then CloseBelow else Double.NaN;
CloseBelowPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
CloseBelowPlot.AssignValueColor(Color.White);
#POINTS