You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

barstate.islastconfirmedhistory重新添加指标后时间未变是否为正常现象?

关于Pine Script中last confirmed history bar的行为问题

这是预期的正常行为,和你使用Brave浏览器没有关系。

TradingView的图表引擎会基于当前市场数据维护已确认K线的状态,barstate.islastconfirmedhistory指向的是图表中最后一根完全闭合的K线,这个标记由市场数据本身决定,和指标的添加、移除操作无关。哪怕你移除后重新添加未修改的指标,只要没有新的K线闭合,这个位置就不会发生变化。

你的代码通过以下逻辑标记该K线:

//@version=5
indicator("My script", overlay = true, max_labels_count = 500)
bgcolor(barstate.islastconfirmedhistory ? color.rgb(232, 196, 238) : na)
plotchar(na,"","",location =  location.top)

只要市场没有产生新的闭合K线,重新添加指标后,这个高亮的位置自然不会改变。

内容的提问来源于stack exchange,提问作者Moebius

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 18:15:36