[LegacyColorValue = true];
{
Notes: Paints bars based on the change of price from the lowest low or highest high
of a given period with the addition of the Average True Range
Input: BarLength - Number of bars to calculate lowest low or highest high (16 is the default value)
ATRLength - Number of days to calculate the ATR and the SMA of the ATR
This version is different from the base version in that there are no "neutral" bars. Any
neutral bars are assumed to hold the direction/color of the prior bar.
}
Input: BarLength(16), ATRLength(9), ATRMultiple(2.5), pPlotWidth(1);
Variables: SwingDirection(0);
SwingDirection = LBRSwing2(BarLength,ATRLength,ATRMultiple);
If CurrentBar > 1 Then Begin
If SwingDirection = 1 then
PlotPaintBar(High, Low, Open, Close, "LongShort", Green, Default, pPlotWidth);
If SwingDirection = -1 then
PlotPaintBar (High, Low, Open, Close, "LongShort", Red, Default, pPlotWidth);
{Show ATR range on on Screen}
Variable: ValueToPaint(0),Junk(False);
ValueToPaint = AverageFC(AvgTrueRange(ATRLength), ATRLength) * ATRMultiple;
Junk = DrawTextOnLastbar(-999999,0,NumToStr(ValueToPaint,2),Highest(High,3) + (3*TickValue),White,3);
If CommentaryEnabled Then Begin
CommentaryCL("The Value for switching colors is: ", ValueToPaint);
End;
End;

Comment