Help get this topic noticed by sharing it on Twitter, Facebook, or email.

How to get total number of bars on chart?

How do I get the total number of bars on the chart before the plot is finished?

I know the variable "n" exists, but it only gives the current bar number, not the total.

The reason I need to know this is I want to plot something like this:

bars_before_last_bar = total_bars - n
plot(bars_before_last_bar < 10 ? high : na)

I.e. I want to do something different when we're 10 bars from the end of the chart.
1 person has
this question
+1
Reply