Wycok hl//@version=5
indicator("Wyckoff Trend Indicator", overlay=true)
// Input Parameters
ma_length = input.int(50, title="Moving Average Length", minval=1)
volume_threshold = input.float(1.5, title="Volume Threshold Multiplier", minval=0.1)
// Calculate Moving Average
ma = ta.sma(close, ma_length)
// Volume Analysis
avg_volume = ta.sma(volume, ma_length)
high_volume = volume > (volume_threshold * avg_volume)
// Price and Volume Conditions
uptrend = close > ma and high_volume
downtrend = close < ma and high_volume
accumulation = close > ma and volume < avg_volume
distribution = close < ma and volume < avg_volume
// Plotting Signals
plot(ma, color=color.blue, linewidth=2, title="Moving Average")
bgcolor(uptrend ? color.new(color.green, 80) : na, title="Uptrend Background")
bgcolor(downtrend ? color.new(color.red, 80) : na, title="Downtrend Background")
// Adding Labels
if uptrend
label.new(bar_index, high, "Uptrend", style=label.style_circle, color=color.new(color.green, 20))
if downtrend
label.new(bar_index, low, "Downtrend", style=label.style_circle, color=color.new(color.red, 20))
if accumulation
label.new(bar_index, low, "Accumulation", style=label.style_label_up, color=color.new(color.yellow, 20))
if distribution
label.new(bar_index, high, "Distribution", style=label.style_label_down, color=color.new(color.purple, 20))