为什么我可以根据断线或断线而不是分步线的条件来更改线条颜色?由于某些原因,当我使用stepline作为我的线条选项时,它会忽略条件并仅使用第一种颜色。有什么想法吗?
//@version=3
study("My Script", overlay=true)
lookback = input(title="Lookback Period", type=integer, defval=9, minval=1)
HighestHigh = highest(close, lookback)[1]
LowestLow = lowest(close, lookback)[1]
highlinecolor = if HighestHigh > HighestHigh[1]
green
else
if HighestHigh < HighestHigh[1]
red
else
gray
lowlinecolor = if LowestLow > LowestLow[1]
green
else
if LowestLow < LowestLow[1]
red
else
gray
plot(HighestHigh, color=highlinecolor, linewidth=2, transp=0, title="Highest high", style=line)
plot(LowestLow, color=lowlinecolor, linewidth=2, transp=0, title="Lowest Low", style=stepline)