首页 > 解决方案 > Pine 脚本,如果问题

问题描述

我在下面的代码中有问题,你能帮我解决吗?

if wt1 < 5 and wt1 > -5
plot(cross(wt1, wt2) ? wt2 : na, color = black , style = circles, linewidth = 4)
plot(cross(wt1, wt2) ? wt2 : na, color = (wt2 - wt1 > 0 ? red : lime) , style = circles, linewidth = 4)

else if wt1 > 53 and wt2 > 53
plot(cross(wt1, wt2) ? wt2 : na, color = black , style = circles, linewidth = 4)
plot(cross(wt1, wt2) ? wt2 : na, color = (wt2 - wt1 > 0 ? red : lime) , style = circles, linewidth = 4)

else if wt1 < -53 and wt2 < -53
plot(cross(wt1, wt2) ? wt2 : na, color = black , style = circles, linewidth = 4)
plot(cross(wt1, wt2) ? wt2 : na, color = (wt2 - wt1 > 0 ? red : lime) , style = circles, linewidth = 4)

else
na

标签: pine-script

解决方案


我不是心灵感应者,但我会尝试猜测您对运算符中的空格有疑问if

if wt1 < 5 and wt1 > -5
    plot(cross(wt1, wt2) ? wt2 : na, color = black , style = circles, linewidth = 4)
    plot(cross(wt1, wt2) ? wt2 : na, color = (wt2 - wt1 > 0 ? red : lime) , style = circles, linewidth = 4)

else if wt1 > 53 and wt2 > 53
    plot(cross(wt1, wt2) ? wt2 : na, color = black , style = circles, linewidth = 4)
    plot(cross(wt1, wt2) ? wt2 : na, color = (wt2 - wt1 > 0 ? red : lime) , style = circles, linewidth = 4)

else if wt1 < -53 and wt2 < -53
    plot(cross(wt1, wt2) ? wt2 : na, color = black , style = circles, linewidth = 4)
    plot(cross(wt1, wt2) ? wt2 : na, color = (wt2 - wt1 > 0 ? red : lime) , style = circles, linewidth = 4)

else
    na

推荐阅读