我想构建一个执行以下操作的algo:
当价格超过20个杆的时候:买入
当价格向下突破20-bars :空头
你能帮帮我吗?
//@version=3
study("My Script")
strategy("MA Crossover", overlay=true)
x = sma(close,1)
y = sma(close,20)
longCondition = crossover(x, y)
if (longCondition)
strategy.entry("Long", strategy.long)
shortCondition = crossunder(x, y)
if (shortCondition)
strategy.entry("Short", strategy.short)发布于 2020-04-22 02:26:10
//@version=4
strategy("MA Crossover", overlay=true, process_orders_on_close = true)
x = sma(close,1)
y = sma(close,20)
longCondition = crossover(x, y)
if (longCondition)
strategy.entry("Long", strategy.long)
shortCondition = crossunder(x, y)
if (shortCondition)
strategy.entry("Short", strategy.short)https://stackoverflow.com/questions/61312589
复制相似问题