pine-script - 如何从柱上的最高价或最低价关闭所有订单?
问题描述
我有如下策略,每笔交易有多个条目。我想在 %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 is the solution.
推荐阅读
- javascript - 移动另一列中两列之间共有的元素
- node.js - 无法使用cheerio抓取链接
- angular - 在 Angular 8 中创建 App shell 时出错
- javascript - 渲染文本区域中输入的换行符
- xamarin.forms - 没有第三方库的 xamarin.forms 授权
- python - 没有提供静态文件夹的烧瓶轮文件
- javascript - 手机上无限连续循环滚动
- spring-boot - 如何调试永远不会完成的 Mono
- firebase - Firebase/Firestore 静态加密级别
- postgresql - SQL 中的 MIN 函数未按预期工作