我试图在最近140个柱状图中显示最高和最低的直方图。 我的代码工作太热情了,因为它在每个小节上绘制,而不仅仅是最高和最低。
我玩了一段时间,一直没有找到答案。如果您有空的话,希望有一些建议。
谢谢 阿里
study("Oscillator (AO)")
nLengthSlow = input(34, minval=1, title="Length Slow")
nLengthFast = input(5, minval=1, title="Length Fast")
xSMA1_hl2 = sma(hl2, nLengthFast)
xSMA2_hl2 = sma(hl2, nLengthSlow)
//indicator
AOval = xSMA1_hl2 - xSMA2_hl2
// Determine colour
lineColour = (AOval > AOval[1]) and (AOval > 0) ? lime :
(AOval < AOval[1]) and (AOval > 0) ? green :
(AOval > AOval[1]) and (AOval < 0) ? red :
maroon
UPpeak = highest(AOval, 140) and (AOval > 0)
DNpeak = lowest(AOval, 140) and (AOval < 0)
plot(AOval, style=histogram, linewidth=3, color=lineColour)
plotshape(UPpeak, title="UPpeak", text="3", style=shape.circle, location=location.bottom, color=blue, size=size.auto, transp=60)
plotshape(DNpeak, title="DNpeak", text="3", style=shape.circle, location=location.bottom, color=orange, size=size.auto, transp=60)