【问题标题】:having trouble backtesting based on stochastic基于随机的回测有困难
【发布时间】:2018-12-16 00:18:34
【问题描述】:

嗨,我正在尝试测试随机指标是否超过 80,购买 如果随机交叉低于 20 卖出

由于某种原因,订单没有被正确执行(我的意思是它根本没有被执行) 关于为什么会发生这种情况的任何想法?

//@version = 2
strategy("buy signal entry")
signal = stoch(close,high,low,14)
//plot stochastics
plot(signal,color = white)
//buy when signal crossover 80 and sell when it crossunder 20
buysignal = crossover(signal,80)
sellsignal = crossunder(signal,20)
if(buysignal)
    strategy.entry("buy", strategy.long)
if(sellsignal)
    strategy.exit("exit", "buy")

【问题讨论】:

    标签: pine-script stochastic


    【解决方案1】:

    根据关于 strategy.close 的文档,您需要使用 strategy.exit 而不是 strategy.close

    要使用市价单退出,应使用命令 strategy.close 或 strategy.close_all。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多