Is there a way I can access the time of the next bar index in Pinescript? I need it to work in the case when the market is closed as well. For example, if the market closed at 18:55 today (bar_index) then technically the time of bar_index + 1 should be tomorrow morning at 3:00. Another example, if the market closed at 18:55 today and it is Friday then the time of bar_index + 1 should be Monday at 3:00. How can I access the time of the next bar index even despite time jumps like this? I am currently doing something like nextBarTime = time + ta.change(time)
to get the time of the next bar index but it doesn't work with these time jumps.
有没有办法在Pinescript中获取下一个条形索引的时间?我需要它在市场关闭的情况下发挥作用。例如,如果市场在今天18:55收盘(Bar_Index),那么从技术上讲,bar_index+1的时间应该是明天早上3:00。另一个例子是,如果今天18:55收盘,现在是周五,那么bar_index+1的时间应该是周一3:00。即使有这样的时间跳跃,我如何获取下一个条形图指数的时间?我目前正在执行类似nextBarTime=time+ta.change(Time)的操作来获取下一个条形图索引的时间,但它不适用于这些时间跳跃。
更多回答
You have zero knowledge of the next
candle when you are at the current candle, thus you won't make any trading decisions there or that's gambling. However you can always work with the previous candle and know how much time has passed.
当你在当前的蜡烛处时,你对下一根蜡烛一无所知,因此你不会在那里做出任何交易决定,否则这就是赌博。但是,您可以随时使用前一根蜡烛,并知道多少时间已经过去。
优秀答案推荐
Technically there is no built-in function yet to get future time of the bar, you can write your own function which will add time offset to the current bar (and will take into account session, weekends and holidays).
从技术上讲,还没有内置的函数来获取酒吧的未来时间,你可以编写自己的函数,将时间偏移量添加到当前的酒吧(并将考虑会议,周末和节假日)。
(if you need to check if a new bar is from the new session you may use simplier solution to detect that: session.isfirstbar
variable).
(如果您需要检查新的BAR是否来自新会话,您可以使用更简单的解决方案来检测:ession.isfirst stbar变量)。
更多回答
我是一名优秀的程序员,十分优秀!