我有t = time(timeframe.period, "1430-2100:12345")
但是,当我的策略在一天开始的时候对以前的酒吧进行统计时,它会影响到/看一看市场前的酒吧。
我在交易和索引,在那里我不能关闭延长的时间在设置,所以有一个方法,使代码忽略市场前的酒吧?
“策略”(“测试”,overlay = true)
T=时间(timeframe.period,"1430-2100:12345")
购买=低< low1和t出售=高> high2和t
短=高> high1和t覆盖=低< low2和t
Strategy.entry(“长条目”,strategy.long,1,when = buy) strategy.close("Long Entry",when = sell)
Strategy.entry(“短条目”,strategy.short,1,when = short) strategy.close("Short Entry",when = cover)
如果(不是) strategy.close_all()`
发布于 2022-05-19 18:04:19
您可以使用session.ismarket或session.ispremarket内置变量。
例如:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © vitruvius
//@version=5
indicator("My script")
t = time(timeframe.period, "0900-2100:12345")
b = session.ismarket and t
plot(b ? 1 : 0)

https://stackoverflow.com/questions/72306964
复制相似问题