if double.nan is spacing out your plots, how do you get the previous value that was a number?
here's the code i'm working with:
the last two lines are the problem. it will never plot the green vertical line, even when there's a higher high, because highPeakPlot[2] isn't a number. I just want to be able to reference the second to last highPeakPlot that Was A Number . . .
not sure how.
here's the code i'm working with:
Code:
def lowPeak = if close[1]>close and close[-1]>close then 1 else 0;
def highPeak = if close[1]<close and close[-1]<close then 1 else 0;
plot lowPeakPlot = if lowPeak == 1 then close else double.nan;
lowPeakPlot.setPaintingStrategy(paintingstrategy.points);
plot highPeakPlot = if highPeak == 1 then close else double.nan;
highPeakPlot.setPaintingStrategy(paintingstrategy.points);
def higherHighTwo = if highPeakPlot > highPeakPlot[2] then 1 else 0;
addVerticalLine(higherHigh, "higher high", color.green);
the last two lines are the problem. it will never plot the green vertical line, even when there's a higher high, because highPeakPlot[2] isn't a number. I just want to be able to reference the second to last highPeakPlot that Was A Number . . .
not sure how.
Last edited: