Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Pine script 订单在同一条上执行止损和反转_Pine Script - Fatal编程技术网

Pine script 订单在同一条上执行止损和反转

Pine script 订单在同一条上执行止损和反转,pine-script,Pine Script,我的策略是在同一条上执行止损和反转指令。 这导致我的仓位大小超出我的风险参数 我看到了一些关于这个话题的问题,但我找不到答案。 订单可以在同一条上执行吗 if (strategy.position_size < 1) and enterLong strategy.entry(id="EL", long=true, qty=posSize, stop=upperband + syminfo.mintick) if (strategy.position_size &

我的策略是在同一条上执行止损和反转指令。 这导致我的仓位大小超出我的风险参数

我看到了一些关于这个话题的问题,但我找不到答案。 订单可以在同一条上执行吗

if (strategy.position_size < 1) and enterLong 
    strategy.entry(id="EL", long=true, qty=posSize,
        stop=upperband + syminfo.mintick)

if (strategy.position_size > -1) and enterShort 
    strategy.entry(id="ES", long=false, qty=posSize,
        stop=lowerband - syminfo.mintick)

if(strategy.position_size > 0) and preventShort
    strategy.exit(id="XL", stop=longStopPrice)
if(strategy.position_size < 0) and preventLong
    strategy.exit(id="XS", stop=shortStopPrice)
if(strategy.position\u size<1)和enterLong
策略输入(id=“EL”,long=true,qty=posSize,
停止=上带+符号信息.mintick)
如果(strategy.position\u size>-1)并输入short
策略输入(id=“ES”,long=false,qty=posSize,
停止=下边-符号信息.mintick)
如果(strategy.position_size>0)和preventShort
策略.退出(id=“XL”,停止=longStopPrice)
如果(策略位置大小<0)和预防长
策略退出(id=“XS”,stop=shortStopPrice)
我希望能够用准确的风险参数来测试我的策略。
我的结果被扭曲了,因为仓位太大。

这种行为是由于代理模拟器中的错误造成的。应该在不久的将来修复


请注意,在多个地方问同一个问题是一种糟糕的做法,因为你有可能让不同的人同时研究和/或回答,就像这个问题一样。

Hmm有趣,可能会增加一些延迟?