如何平掉第二个目标价的全部剩余仓位?
我正在尝试设置 2 个 TP,但是我总是有一些剩余的东西需要第三个关闭来清理。
这是我当前的代码:
acct_size = input(500, group="Trading Settings")
pct_of_account_to_order = input(100, group="Trading Settings") / 100
qty = acct_size * pct_of_account_to_order / close
nbr_tps = input(3, group="Trading Settings")
qty_tp = qty / nbr_tps
qty_tp_pct = 0
现在这是我的尝试...
if strategy.position_size<strategy.position_size[1] and strategy.position_size>0
qty_tp_pct := 100
if closeLongCond
strategy.close("Long 1",qty=qty_tp,qty_percent=qty_tp_pct,alert_message=close_long_alert_msg)
无论我尝试什么,我仍然会挂在那里需要单独关闭的“剩余部分”,例如:
我 已阅读 qty_percent 胜过 qty 的优先级(在 pine至少版本 4),所以我认为将其设置为 100 会起作用,但没有骰子。确实需要一些帮助。
I am trying to set 2 TPs, however I always have a bit of leftover that needs a third close to clean up.
Here is my current code:
acct_size = input(500, group="Trading Settings")
pct_of_account_to_order = input(100, group="Trading Settings") / 100
qty = acct_size * pct_of_account_to_order / close
nbr_tps = input(3, group="Trading Settings")
qty_tp = qty / nbr_tps
qty_tp_pct = 0
Now here's my attempt...
if strategy.position_size<strategy.position_size[1] and strategy.position_size>0
qty_tp_pct := 100
if closeLongCond
strategy.close("Long 1",qty=qty_tp,qty_percent=qty_tp_pct,alert_message=close_long_alert_msg)
I'm still getting a "remainder" hanging there that needs to be closed separately, no matter what I try, e.g.:
I have read that qty_percent trumps qty in priority (in pine versin 4 at least), so I figured setting it to 100 would work, but no dice. Could really use some help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论