Hi,@BenTen this is a ATR plot i have created following the contributions from the members. It plots the two levels below the low of the closing candle. Currently, it plots for all the candles for the timeframe we selected and it is abit messy. May i know if there is any way we can just plot the ATR for the last 3 candles?
Thanks
Thanks
Code:
input aggregationPeriod = AggregationPeriod.DAY;
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def close = close(period = aggregationPeriod);
def Ylow = low(period = "day" );
input length = 14;
input averageType = AverageType.WILDERS;
def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);
def FP=Ylow-ATR;
plot FP1= FP;
FP1.SetDefaultColor(Color.Green);
FP1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
def ATR2 = (yLOw - (ATR*2));
plot line = ATR2;
LINE.SetDefaultColor(Color.White);
LINE.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
addLabel (yes, "FP1 = " + Roundup(FP, 0),color.yellow);
addLabel (yes, "FP2 = " + Roundup(ATR2, 0),color.BLUE);