如何使用 if 语句为我的脚本创建条件?
How do I create a condition with my script using the if statement?
我在 if 语句方面遇到了一些挑战。我希望仅当代码 (plotshape) 为假时才绘制下面的代码 (plotchar)。如果代码 (plotshape) 为真,则不应绘制代码 (plotchar)。
plotshape (show_atr_rule ? atrchecklocation : na, style=shape.circle, location=absolute, size=tiny, color=color.yellow, transp=20)
plotchar(codiff_long, color=color.green, location=location.abovebar, text="BUY", transp=0)
plotchar(codiff_short, color=color.red, location=location.belowbar, text="SELL", transp=0)
在 plotchar
函数的 series
参数内创建一个三元条件,与您对 plotshape
:
所做的相同
plotshape (show_atr_rule ? atrchecklocation : na, style=shape.circle, location=absolute, size=tiny, color=color.yellow, transp=20)
plotchar(show_atr_rule ? na : codiff_long, color=color.green, location=location.abovebar, text="BUY", transp=0)
plotchar(show_atr_rule ? na : codiff_short, color=color.red, location=location.belowbar, text="SELL", transp=0)
我在 if 语句方面遇到了一些挑战。我希望仅当代码 (plotshape) 为假时才绘制下面的代码 (plotchar)。如果代码 (plotshape) 为真,则不应绘制代码 (plotchar)。
plotshape (show_atr_rule ? atrchecklocation : na, style=shape.circle, location=absolute, size=tiny, color=color.yellow, transp=20)
plotchar(codiff_long, color=color.green, location=location.abovebar, text="BUY", transp=0)
plotchar(codiff_short, color=color.red, location=location.belowbar, text="SELL", transp=0)
在 plotchar
函数的 series
参数内创建一个三元条件,与您对 plotshape
:
plotshape (show_atr_rule ? atrchecklocation : na, style=shape.circle, location=absolute, size=tiny, color=color.yellow, transp=20)
plotchar(show_atr_rule ? na : codiff_long, color=color.green, location=location.abovebar, text="BUY", transp=0)
plotchar(show_atr_rule ? na : codiff_short, color=color.red, location=location.belowbar, text="SELL", transp=0)