Pinescript 无法处理除法比较?
Pinescript can't handle division comparisons?
以下脚本应在相同条形图的顶部和底部生成标签。但是 mySeries1
会在每个栏下放置一个标签。 pinescript 无法处理这个问题还是我做错了什么?
//@version=4
study(title = "Division?", overlay=true)
labelPosLow = low - (atr(30) * 0.6)
labelPosHigh = high + (atr(30) * 0.6)
totalLength = high - low
mySeries1 = close - low >= 1/2 * totalLength
if mySeries1
label.new(bar_index, labelPosLow, text="A", style=label.style_label_up, color = color.blue, textcolor=color.white)
mySeries2 = close - low >= 0.5 * totalLength
if mySeries2
label.new(bar_index, labelPosHigh, text="B", style=label.style_label_down, color = color.green, textcolor=color.white)
不确定您要做什么,或者您是否知道 1/2 在 pine 脚本中不等于 0.5。将 1/2 更改为 1.0/2.0,这可能有效
以下脚本应在相同条形图的顶部和底部生成标签。但是 mySeries1
会在每个栏下放置一个标签。 pinescript 无法处理这个问题还是我做错了什么?
//@version=4
study(title = "Division?", overlay=true)
labelPosLow = low - (atr(30) * 0.6)
labelPosHigh = high + (atr(30) * 0.6)
totalLength = high - low
mySeries1 = close - low >= 1/2 * totalLength
if mySeries1
label.new(bar_index, labelPosLow, text="A", style=label.style_label_up, color = color.blue, textcolor=color.white)
mySeries2 = close - low >= 0.5 * totalLength
if mySeries2
label.new(bar_index, labelPosHigh, text="B", style=label.style_label_down, color = color.green, textcolor=color.white)
不确定您要做什么,或者您是否知道 1/2 在 pine 脚本中不等于 0.5。将 1/2 更改为 1.0/2.0,这可能有效