Lumberjack88
New member
I need a fairly basic horizontal line plot of a pre-calculated level, say 410. I want the horizontal line to extend 100 bars to the left and 20 bars to the right of the most recent candle, no matter if it's the hourly, daily or 1m timeframe. It should only count the visible bars, not the hidden, pre-market, after-hours bars.
The following code should work in theory but it doesn't:
Why isn't this working as expected? Did I do something wrong in the line definition part?
The following code should work in theory but it doesn't:
HTML:
declare upper;
input price = 410;
input lengthLeft = 100;
input lengthRight = 20;
def line = if BarNumber() >= HighestAll(BarNumber()) - lengthLeft and BarNumber() <= HighestAll(BarNumber()) + lengthRight then price else Double.NaN;
plot linePlot = line;
linePlot.SetDefaultColor(Color.BLUE);
linePlot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linePlot.SetLineWeight(2);
linePlot.SetStyle(Curve.SHORT_DASH);
Why isn't this working as expected? Did I do something wrong in the line definition part?