我正在使用 Renko 图表进行策略测试。我正在使用 1 分钟 TF 和块大小 10。我想在当前价格完成 1 分钟时进入。我尝试对此进行编码但无法获得 下个街区开盘时间 我在下面的代码中有进入条件,也想添加这个条件 “如果下一个区块的开盘时间!=当前蜡烛的开盘时间,在当前蜡烛结束时输入” 我试图添加时间戳..但它不起作用.
提前致谢
问候 惩罚
//Define block open and block close
BlockOpen = open
BlockClose = close
Entry() =>
BlockClose[0] > BlockOpen[2] and BlockClose[2] < BlockOpen[4]
Exit() =>
BlockClose[0] < BlockOpen[2] and BlockClose[2] > BlockOpen[4]
// Set the time when the next bar should start
next_bar_time = timestamp(year, month, dayofmonth, hour, minute) + 60 * 1000
// Wait until the next bar starts
wait_for_next_bar = time > next_bar_time
//Strategy
if Entry() and (wait_for_next_bar)
strategy.entry("Buy", strategy.long)
if Exit()
strategy.close("Buy")
if Exit() and (wait_for_next_bar)
strategy.entry("Sell", strategy.short)
if Entry()
strategy.close("Sell")