What is lastconfirmedhistory at all?
Returns true if script is executing on the dataset's last bar when market is closed, or script is executing on the bar immediately preceding the real-time bar, if market is open. Returns false otherwise.
source
It is supposed to work like that. The determinant here is the data set of tradingview concerning historical- and real-time bars. Your browser does not matter at all. It's the data history or data change respectively and the execution model of pine script that is responsible for this.
Apperantly if you load a ticker with a timeframe, it sets the baseline for the lastconfirmed history, not the adding of the indicator.
@vitruvius had an excellent answer on this here
You could use barstate.iconfirmed for what you may need however note that bgcolor() is not dynamic meaning you cannot change it from a future point (eg. remove it). So if you use a label.new()
instead you can achieve exactly what you want like this:
var label l = na
if barstate.isconfirmed and not barstate.ishistory
label.delete(l)
l := label.new(bar_index, high, "mark previous bar")