Pine script 从0600缩短到0800,代码现在每秒钟缩短一次
我试图回溯测试上午6点到8点之间的空头是否明智,但代码每隔一小时生成一个位置: 我想知道是否有人知道如何将代码改为仅短于0600到0800Pine script 从0600缩短到0800,代码现在每秒钟缩短一次,pine-script,algorithmic-trading,Pine Script,Algorithmic Trading,我试图回溯测试上午6点到8点之间的空头是否明智,但代码每隔一小时生成一个位置: 我想知道是否有人知道如何将代码改为仅短于0600到0800 strategy("Backtest 1 hour", overlay = true) timeFilter = (year >= 2018) and (month >= 7) Longcondition = time("0600") and timeFilter if (Longcondition)
strategy("Backtest 1 hour", overlay = true)
timeFilter = (year >= 2018) and (month >= 7)
Longcondition = time("0600") and timeFilter
if (Longcondition)
strategy.entry("Short",strategy.short, qty = 10)
Closecondition = timeFilter and time("0800")
if (Closecondition)
strategy.close_all()```
啊哈,魔鬼就在细节中!谢谢:-)
//@version=4
strategy("Backtest 1 hour", overlay = true, process_orders_on_close=true)
timeFilter = (year >= 2018) and (month >= 7)
Longcondition = time("", "0600-0601") and timeFilter
if (Longcondition)
strategy.entry("Short",strategy.short, qty = 10)
Closecondition = timeFilter and time("", "0800-0801")
if (Closecondition)
strategy.close_all()