so, i found the code here that you see below, plotting various ATR lines based on the daily close. i thought it'd be a simple matter for me to figure out how to show just the line based on yesterday's close (skipping all the previous days) but for some reason i just can't figure it out. could i get a lil help?
i do like the way that last line is currently plotted, outside of the close. now if only i could get it extended to the right, that'd be even better.
thanks!
i do like the way that last line is currently plotted, outside of the close. now if only i could get it extended to the right, that'd be even better.
thanks!
Code:
input ATRperiod = 5;
input averageType = AverageType.WILDERS;
input BasePeriod = AggregationPeriod.DAY;
input ATRMultiplier = 1;
input ATRMultiplier2 = 2;
input ATRMultiplier3 = 3;
input ATRMultiplier4 = 4;
def ATR = MovingAverage(averageType, TrueRange(high(period = ”DAY”)[1], close(period = ”DAY”)[1], low(period = ”DAY”)[1]), ATRperiod);
def DailyClose = close(period = ”DAY”)[1];
plot HighATR = DailyClose + ATR;
plot LowATR = DailyClose - ATR;
plot HighATR2 = DailyClose + ATR * ATRMultiplier2;
plot LowATR2 = DailyClose - ATR * ATRMultiplier2;
plot HighATR3 = DailyClose + ATR * ATRMultiplier3;
plot LowATR3 = DailyClose - ATR * ATRMultiplier3;
plot HighATR4 = DailyClose + ATR * ATRMultiplier4;
plot LowATR4 = DailyClose - ATR * ATRMultiplier4;
HighATR.SetDefaultColor(color = Color.RED);
HighATR2.SetDefaultColor(color = Color.RED);
HighATR3.SetDefaultColor(color = Color.RED);
HighATR4.SetDefaultColor(color = Color.RED);
LowATR.SetDefaultColor(color = Color.GREEN);
LowATR2.SetDefaultColor(color = Color.GREEN);
LowATR3.SetDefaultColor(color = Color.GREEN);
LowATR4.SetDefaultColor(color = Color.GREEN);
HighATR.SetPaintingStrategy(PaintingStrategy.DASHES);
HighATR2.SetPaintingStrategy(PaintingStrategy.DASHES);
HighATR3.SetPaintingStrategy(PaintingStrategy.DASHES);
HighATR4.SetPaintingStrategy(PaintingStrategy.DASHES);
LowATR.SetPaintingStrategy(PaintingStrategy.DASHES);
LowATR2.SetPaintingStrategy(PaintingStrategy.DASHES);
LowATR3.SetPaintingStrategy(PaintingStrategy.DASHES);
LowATR4.SetPaintingStrategy(PaintingStrategy.DASHES);
AddLabel(visible = yes, text = "ATR: " + Round(ATR / close * 100, 2) + "%", color = Color.LIGHT_GRAY);
AddLabel(visible = Yes, text = "S1: " + Round(LowATR, 2), color = Color.Green);
AddLabel(visible = Yes, text = "R1: " + Round(HighATR, 2), color = Color.Red);