Code:
def isLastBar = !IsNaN(close) and IsNaN(close[-1]);
def lastBarNum = if isLastBar then BarNumber() else 0;
AddChartBubble( "time condition"=lastBarNum, "price location"=high, text="BarNumber" + BarNumber(), color=Color.YELLOW);
AddChartBubble( "time condition"=(lastBarNum - 1), "price location"=high, text="BarNumber" + BarNumber(), color=Color.YELLOW);
The first AddChartBubble adds a bubble at the last bar.
But the second AddChartBubble adds a bubble to ALL the bars. Why?
How can I add a bubble to the 5th bar from the rightmost/last bar?