损失后的Pinsiprcript贸易延迟
我试图在发生损失交易后延迟交易,但到目前为止还没有成功。我的逻辑告诉我,这应该有效:
waitafterloss = input(1,'No. of bars to wait after loss')
newloss = (strategy.losstrades > strategy.losstrades[1]) and (strategy.wintrades == strategy.wintrades[1]) and (strategy.eventrades == strategy.eventrades[1])
barssince = ta.barssince(newloss)
waitcondition = barssince >= waitafterloss
但是没有。
我需要“侍应条”才能返回true或false,以便可以在订单/输入执行中使用它。
有什么想法吗?我在做什么错?也许也有可能有两个输入 - 延迟和失去交易连胜?谢谢
I'm trying to delay trades after a losing trade has happened, but with no success so far. My logic tells me this should work:
waitafterloss = input(1,'No. of bars to wait after loss')
newloss = (strategy.losstrades > strategy.losstrades[1]) and (strategy.wintrades == strategy.wintrades[1]) and (strategy.eventrades == strategy.eventrades[1])
barssince = ta.barssince(newloss)
waitcondition = barssince >= waitafterloss
But it doesnt.
I need the "waitcondition" to return true or false so I could use it in my order/entry execution.
Any ideas? What am I doing wrong? Maybe it would also be possible to have two inputs - delay and losing trades streak? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
waitCondition返回True/fals,但是我会恢复比较逻辑以匹配目的和可变名称。下面的脚本将暂停新的长条目,以防该条件满足条件:
waitcondition returns true/false, however I would revert the comparison logic to match the purpose and variable name. The script below will pause new long entries in case the condition is met: