打开/关闭复合条件
我可以将多个条件添加到一个信号中,但由于我缺乏编程经验,我无法弄清楚如何在选项中打开/关闭不同的条件。
IncludeC1 = input(true)
IncludeC2 = input(false)
条件 1 = 交叉
条件 2 = 船体方向
信号 = 交叉和船体方向
我需要实现此目的 Signal = crossover and (hull (if selected))
基本上这样我就可以在输入部分添加、删除单个条件。
BoxCrossover = ta.crossover(close, boxHigh)
BoxCrossunder = ta.crossunder(close, boxLow)
hull_green = hullma > hullma[1]
hull_red = hullma < hullma[1]
Buy = BoxCrossover and hull_green
Sell = BoxCrossunder and hull_red
我尝试了 if 函数,但无法使其工作。非常感谢任何帮助。
I'm able to add multiple conditions into one signal, but because of my lack of experience programming I can't figure out how could I toggle on/off different conditions in the options.
IncludeC1 = input(true)
IncludeC2 = input(false)
Condition 1 = crossover
Condition 2 = hull direction
Signal = crossover and hull direction
I would need to achieve this
Signal = crossover and (hull (if selected))
Basically so I can add, remove single conditions in the input section.
BoxCrossover = ta.crossover(close, boxHigh)
BoxCrossunder = ta.crossunder(close, boxLow)
hull_green = hullma > hullma[1]
hull_red = hullma < hullma[1]
Buy = BoxCrossover and hull_green
Sell = BoxCrossunder and hull_red
I tried if functions but I can't manage to make it work. Would really appreciate any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试三元条件运算符 。
类似的东西
Try a Ternary Conditional Operator.
Something like that