OPEN-SOURCE SCRIPT

Elliott Wave Helper

52
//version=5
indicator("Elliott Wave Helper", overlay=true)

// Settings
pivotLength = input.int(5, "Pivot Length")
showLabels = input.bool(true, "Show Wave Labels")
zigzagColor = input.color(color.orange, "Zigzag Line Color")

// Find Pivot Highs and Lows
pivotHigh = ta.pivothigh(high, pivotLength, pivotLength)
pivotLow = ta.pivotlow(low, pivotLength, pivotLength)

// Store pivots
var float[] pivotPrices = array.new_float()
var int[] pivotBars = array.new_int()

if not na(pivotHigh)
array.push(pivotPrices, pivotHigh)
array.push(pivotBars, bar_index - pivotLength)

if not na(pivotLow)
array.push(pivotPrices, pivotLow)
array.push(pivotBars, bar_index - pivotLength)

// Draw zigzag line between pivots
for i = 1 to array.size(pivotBars) - 1
x1 = array.get(pivotBars, i - 1)
y1 = array.get(pivotPrices, i - 1)
x2 = array.get(pivotBars, i)
y2 = array.get(pivotPrices, i)
line.new(x1, y1, x2, y2, width=2, color=zigzagColor)

// Label waves as 1-5 or A-C (manual cycling)
if showLabels
waveLabels = array.from("1", "2", "3", "4", "5", "A", "B", "C")
labelText = array.get(waveLabels, (i - 1) % array.size(waveLabels))
label.new(x2, y2, text=labelText, style=label.style_label_up, textcolor=color.white, size=size.small, color=color.blue)

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。