会话开始后,如何使用bar_index绘制第一个栏?

发布于 2025-01-21 22:31:38 字数 452 浏览 3 评论 0原文

我想在市场开放后从1号开始标记每个栏。因此,在这里市场开放了上午9-15,例如选定的时间表为3分钟。因此,我想将第一个栏标记为1,然后将第二个栏标记为2 ..

我看着 a>和 this 。但是对我来说,我想从下一个开口开始再次重新启动标准编号,因此它无济于事。谁能提供一些想法,该如何继续?

I would like to label every bar starting from number 1 after market opens. So here market opens 9-15 AM IST, and for example selected timeframe is 3 mins. So I would like to label the first bar as 1, then second bar as 2.. so on until the market hour ends which is 3-30 PM IST.

I looked at this and this. But for me I want to restart the bar numbering again from next opening, so it is not helping me. Can anyone offer some ideas how can I proceed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

飞烟轻若梦 2025-01-28 22:31:38

您可以使用input.session() + time()函数声明会话,请注意,您还可以使用IANA时区格式指定正确的时区。
mycount varialbe将在会话结束时重置,否则计数以下每个栏:

//@version=5
indicator("session bar counter", overlay = true, max_labels_count = 500)

inputSession = input.session("0915-1530:1234567", "Session") 

inTimeRange = na(time(timeframe.period, inputSession, 'Asia/Calcutta')) == false

myCount = int(na)
myCount := inTimeRange ? nz(myCount[1]) + 1 : 0

if inTimeRange
    label.new(bar_index, high, str.tostring(myCount), color = color(na), textcolor = color.white)

”在此处输入图像描述”

You can declare the session using the input.session() + time() functions, note that you can also specify a correct timezone using the IANA time zone format.
myCount varialbe will reset at the end of the session, otherwise count every bar in:

//@version=5
indicator("session bar counter", overlay = true, max_labels_count = 500)

inputSession = input.session("0915-1530:1234567", "Session") 

inTimeRange = na(time(timeframe.period, inputSession, 'Asia/Calcutta')) == false

myCount = int(na)
myCount := inTimeRange ? nz(myCount[1]) + 1 : 0

if inTimeRange
    label.new(bar_index, high, str.tostring(myCount), color = color(na), textcolor = color.white)

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文