微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何从柱上的最高价或最低价关闭_all_order?

如何解决如何从柱上的最高价或最低价关闭_all_order?

我有如下策略,每笔交易有多个条目。我想在 %x 利润后立即退出

但是 close_all 总是采用柱线收盘价,而不是所需的最高或最低价。

我该怎么做。 ?:

strategy(title =  - TAKE %x PROFIT",shorttitle="15 %1 strategy",overlay=true,pyramiding=10,calc_on_order_fills=true,calc_on_every_tick=true,process_orders_on_close=true)

..
..

    
if (strategy.position_size > 0 )
    strategy.close_all(when=high>=longExitPrice)
    

if (strategy.position_size < 0 )
    strategy.close_all(when=low<=shortExitPrice)

解决方法

    strategy.exit("Stop Loss/TP","LONG",limit=longExitPrice)

strategy.exit 是解决方案。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。