Pinescript Elif功能
我尝试在Pinescript中创建一个ELIF语句,但这是错误的。有人可以帮忙吗?
trend_1 = sma(close, 60)
trend_2 = sma(close, 30)
trend_3 = sma(close, 15)
if bar_index >= 252
trend := trend_1
else if bar_index < 252 and >= 126
trend := trend_2
else
trend := trend_3
不匹配的输入“如果“期望”线路结束而没有线路延续”。
I tried creating an elif statement in Pinescript but it came out as error. Can anyone please help?
trend_1 = sma(close, 60)
trend_2 = sma(close, 30)
trend_3 = sma(close, 15)
if bar_index >= 252
trend := trend_1
else if bar_index < 252 and >= 126
trend := trend_2
else
trend := trend_3
Mismatched input 'if' expecting 'end of line without line continuation'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误是误导的。您忘了为
&gt; =
运算符提供左参数:else如果bar_index&lt; 252 and&gt; = 126
在那里添加另一个
bar_index
,它应该有效:else如果bar_index&lt; 252和bar_index&gt; = 126
The error is misleading. You forgot to supply the left argument for the
>=
operator:else if bar_index < 252 and >= 126
Add another
bar_index
there and it should work:else if bar_index < 252 and bar_index >= 126