OPEN-SOURCE SCRIPT

Accumulation & Distribution Zones with Manipulation

//version=5
indicator("Accumulation & Distribution Zones with Manipulation", overlay=true)

// Parameters
fastLength = input.int(9, title="Fast MA Length")
slowLength = input.int(21, title="Slow MA Length")
manipulationThreshold = input.float(2.0, title="Manipulation Threshold (%)", minval=0)

// Moving Averages
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)

// Plot Moving Averages
plot(fastMA, color=color.blue, title="Fast MA")
plot(slowMA, color=color.red, title="Slow MA")

// Identify Accumulation and Distribution
accumulation = ta.crossover(fastMA, slowMA) // Bullish crossover
distribution = ta.crossunder(fastMA, slowMA) // Bearish crossover

// Plot Accumulation and Distribution Zones
bgcolor(accumulation ? color.new(color.green, 90) : na, title="Accumulation Zone")
bgcolor(distribution ? color.new(color.red, 90) : na, title="Distribution Zone")

// Draw Boxes for Accumulation
var float accumulationStart = na
var float accumulationEnd = na

if accumulation
accumulationStart := low // Start of accumulation candle
accumulationEnd := na // Reset end on new accumulation

if not na(accumulationStart) and not distribution
accumulationEnd := high // Keep updating the end of the accumulation candle

if not na(accumulationEnd)
box.new(bar_index - 1, accumulationStart, bar_index, accumulationEnd, bgcolor=color.new(color.green, 70), border_color=color.green)

// Labels for Accumulation and Distribution
if accumulation and not accumulation[1]
label.new(bar_index, high, "Accumulation", style=label.style_label_down, color=color.green, textcolor=color.white)

if distribution and not distribution[1]
label.new(bar_index, low, "Distribution", style=label.style_label_up, color=color.red, textcolor=color.white)

// Manipulation Detection: Assume manipulation if the price moves significantly within the threshold
manipulation = (close - ta.lowest(low, 5)) / ta.lowest(low, 5) * 100 > manipulationThreshold

// Draw Boxes for Manipulation
var float manipulationStart = na
var float manipulationEnd = na

if manipulation
manipulationStart := low // Start of manipulation candle
manipulationEnd := high // End of manipulation candle

if not na(manipulationStart)
box.new(bar_index - 1, manipulationStart, bar_index, manipulationEnd, bgcolor=color.new(color.yellow, 70), border_color=color.yellow)

// Plot Manipulation Labels
if manipulation
label.new(bar_index, close, "Manipulation", style=label.style_label_down, color=color.yellow, textcolor=color.black)

// Alerts
alertcondition(accumulation, title="Accumulation Alert", message="Potential Accumulation Zone identified!")
alertcondition(distribution, title="Distribution Alert", message="Potential Distribution Zone identified!")
alertcondition(manipulation, title="Manipulation Alert", message="Potential Manipulation detected!")
Chart patternseducationalTrend Analysis

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?

Pernyataan Penyangkalan