繁体   English   中英

Pinescript elif 函数

[英]Pinescript elif function

我尝试在 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

不匹配的输入“如果”期望“行尾没有续行”。

该错误具有误导性。 您忘记为>=运算符提供左参数:

else if bar_index < 252 and >= 126

在那里添加另一个bar_index ,它应该可以工作:

else if bar_index < 252 and bar_index >= 126

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM