[英]Pine Script strategy.exit multiple TP and SL not working
我正在制定具有多个止盈和止损的策略。 一旦我开始交易,我就尝试设置初始止损并获利。 那么如果开启交易管理设置,我也想设置部分tp1和tp2。 但目前只有进入和第一个退出代码在策略中起作用。 重置在策略设置中不起作用。 正如我在另一个线程中发现的那样,我还将 close_entries_rule 设置为“ANY”,但它没有帮助。 见策略面板截图
对我所缺少的有什么想法吗?
strategy(....close_entries_rule="ANY")
strategy.entry('S', strategy.short, limit=close)
strategy.exit('S SL', 'S', stop=shortSL)
strategy.exit('S TP', 'S', limit = shortTP)
if useTradeMgmt
strategy.exit('S TP1', 'S', qty_percent=tp1percent, limit=tp1Price)
strategy.exit('S TP2', 'S', qty_percent=tp2percent, limit=tp2Price)
strategy.entry('S', strategy.short, limit=close)
if useTradeMgmt
strategy.exit('S TP1', 'S', qty_percent=tp1percent, limit=tp1Price, stop=shortSL)
strategy.exit('S TP2', 'S', qty_percent=tp2percent, limit=tp2Price, stop=shortSL)
strategy.exit('S SL', 'S', stop=shortSL, limit = shortTP)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.