[英]Pinescript -Plot happening on every bar, not just highest and lowest
我試圖用 plotshape 表示最后 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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.