Indicator · Pine Script v5 · On the chart

Wyckoff Accumulation Distribution

by bigzhu· code credited to faytterro

Visualizes Wyckoff accumulation and distribution phases directly on the price chart.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code148
Settings4inputs
LicenceNone statedfile: MPL-2.0
Last update3 months ago6 Jul 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

148 lines of Pine Script v5 from docs/指标工具箱/Wyckoff_Accumulation_Distribution/Wyckoff_AD.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Wyckoff_AD.pine
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © faytterro

//@version=5
indicator("Wyckoff Accumulation Distribution", overlay=true, max_boxes_count = 500, calc_bars_count = 1000)

// === Genel ayar ===
color_ = input.color(color.white, "Text Color")

// RSI hesaplama
rsilen = input.int(14, "RSI Length")
rsi = ta.rsi(close, rsilen)
rsisens = input.int(20, title= "trend Sensitivity", maxval=50, minval=0, 
 tooltip = "When it increases, bull and bear signals decrease and horizontal trend signals increase.")

utad = rsi<50+rsisens and rsi[1]>50+rsisens
spring = rsi>50-rsisens and rsi[1]<50-rsisens

// Yüksek ve düşük hesaplama fonksiyonları
myhigh(len) =>
    x = array.new_float()
    for i = 0 to len - 1
        array.push(x, high[i])
    array.max(x)

mylow(len) =>
    x = array.new_float()
    for i = 0 to len - 1
        array.push(x, low[i])
    array.min(x)

// Yatay, yükseliş ve düşüş koşulları
side = (rsi < 50 + rsisens and rsi > 50 - rsisens) or (rsi[1] < 50 + rsisens and rsi[1] > 50 - rsisens)
bull = rsi > 50 + rsisens and rsi[1] > 50 + rsisens
bear = rsi < 50 - rsisens and rsi[1] < 50 - rsisens 

boxlen = ta.barssince(side and not side[1])

barcolor(bull ? color.lime : bear ? color.purple : na, offset = -2)

x1 = ta.valuewhen(side and not side[1], bar_index, 0)
x2 = ta.valuewhen(not side and side[1], bar_index[1], 0)-1
y1 = myhigh(math.max(1, boxlen+1))[2]
y2 = mylow(math.max(1, boxlen+1))[2]

// Kutuyu çizme
var box trendBox = na
if side[1] and not side
    trendBox := box.new(x1, y1, x2, y2, color.gray, 1, line.style_solid, extend.none, xloc.bar_index, x1 < x2 ? color.rgb(120, 123, 134, 90) : na, text_color = color.new(color_,80))

var string after_trend = na
if bull
    after_trend := "Accumulation"
else if bear
    after_trend := "Distribution"

if not na(trendBox) and after_trend == "Accumulation"
    box.set_bgcolor(trendBox, color.rgb(76, 175, 79, 95))
    box.set_text(trendBox, "Accumulation")
else if not na(trendBox) and after_trend == "Distribution"
    box.set_bgcolor(trendBox, color.rgb(255, 82, 82, 95))
    box.set_text(trendBox, "Distribution")

pivotLen = input.int(5, "Pivot Length", minval=1)
rsiLow = 50 - rsisens
rsiHigh = 50 + rsisens
offsetVal = -pivotLen

pivotLow = ta.pivotlow(low, pivotLen, pivotLen)
pivotHigh = ta.pivothigh(high, pivotLen, pivotLen)
rsiAtPivot = rsi[pivotLen]

// Flagler
var bool isSCFlag = false
var bool isARFlag = false
var bool isSTFlag = false
var bool isBCFlag = false
var bool isDARFlag = false
var bool isDSTFlag = false

// SC
isSC = pivotLow and rsiAtPivot < rsiLow and not isSCFlag and not spring
plotshape(isSC, "The Selling Climax", location=location.belowbar, style=shape.triangleup, color=color.green, size=size.tiny, offset=offsetVal, text="SC", textcolor=color_, display = display.pane)
isSCFlag := isSC ? true : isSCFlag

// AR
var int scBarIndex = na
if isSC
    scBarIndex := bar_index - pivotLen
isAR = false
if not na(scBarIndex)
    if pivotHigh and (bar_index - pivotLen > scBarIndex) and not isARFlag
        isAR := true
        scBarIndex := na
isARFlag := isAR ? true : isARFlag
plotshape(isAR, "Automatic Rally", style=shape.triangledown, location=location.abovebar, color=color.green, size=size.tiny, offset=offsetVal, text="AR", textcolor=color_, display = display.pane)

// ST (Accumulation)
var int pivotCounter = 0
if pivotLow
    pivotCounter := pivotCounter + 1
if rsiAtPivot < rsiLow
    pivotCounter := 0
isST = pivotCounter == 1 and pivotLow and not isSTFlag 
plotshape(isST,"the Secondary Test", location=location.belowbar, style=shape.triangleup, color=color.green, size=size.tiny, offset=offsetVal, text="ST", textcolor=color_, display = display.pane)
isSTFlag := isST ? true : isSTFlag

// BC
isBC = rsiAtPivot > rsiHigh and pivotHigh and not isBCFlag and not utad
plotshape(isBC,"The Buying Climax", location=location.abovebar, style=shape.triangledown, color=color.red, size=size.tiny, offset=offsetVal, text="BC", textcolor=color_, display = display.pane)
isBCFlag := isBC ? true : isBCFlag

// DAR
var int bcBarIndex = na
if isBC
    bcBarIndex := bar_index - pivotLen
isDAR = false
if not na(bcBarIndex)
    if pivotLow and (bar_index - pivotLen > bcBarIndex) and not isDARFlag
        isDAR := true
        bcBarIndex := na
isDARFlag := isDAR ? true : isDARFlag
plotshape(isDAR,"Automatic Reaction", location=location.belowbar, style=shape.triangleup, color=color.red, size=size.tiny, offset=offsetVal, text="AR", textcolor=color_, display = display.pane)

// DST
var int darBarIndex = na
if isDAR
    darBarIndex := bar_index - pivotLen
isDST = false
if not na(darBarIndex)
    if pivotHigh and (bar_index - pivotLen > darBarIndex) and not isDSTFlag and not isBC
        isDST := true
        darBarIndex := na
isDSTFlag := isDST ? true : isDSTFlag
plotshape(isDST,"The Secondary Test", location=location.abovebar, style=shape.triangledown, color=color.red, size=size.tiny, offset=offsetVal, text="ST", textcolor=color_, display = display.pane)

// Diğer pivotlar (turuncu)
plotshape(pivotLow and not isSC and not isST and not isAR and not isDAR, "pivotHigh", location=location.belowbar, style=shape.triangleup, color=color.orange, size=size.auto, offset=offsetVal, display = display.pane)
plotshape(pivotHigh and not isAR and not isDST and not isBC,"pivotLow", location=location.abovebar, style=shape.triangledown, color=color.orange, size=size.auto, offset=offsetVal, display = display.pane)

// Reset flagler
if bar_index != bar_index[1]
    isSCFlag := false
    isARFlag := false
    isSTFlag := false
    isBCFlag := false
    isDARFlag := false
    isDSTFlag := false

Overview

Wyckoff Accumulation Distribution uses an RSI-based sensitivity threshold to determine trend conditions and horizontal ranges, framing consolidation zones with colored boxes. The script also identifies structural Wyckoff schematic events, such as Selling Climax and Automatic Rally signals, using pivot high and low conditions combined with historical RSI thresholds. Users can adjust trend sensitivity, RSI length, and pivot evaluation periods.

Details

Published by

bigzhu on GitHub

Code credit

faytterro, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

SMC / ICT / price action, Oscillators & momentum, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Text Colorcolorcolor.whitecolor_
RSI Lengthint14rsilen
trend Sensitivityint20rsisens
Pivot Lengthint5pivotLen
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This overlay indicator scores liquidity-sweep reversals on the price chart. It looks for a swing high or low violation followed by a recovery close, then grades optional conditions such as RSI and structure into a 0–2 quality score with separate long and short

Indicator v6 SMC / ICT / price actionOscillators & momentum
Updated yesterday · MIT GitHub repository of Reversal Engine Score v1 [WavesUnchained]

Cerebr Bot

by jerryinyang
5 stars

Cerebr Bot is an overlay indicator that maps order blocks and fair value gaps on the price chart. It validates order blocks using a candle-count range, a no-body buffer, and an optional reversal-magnitude filter based on candle body or the selected method. RSI

Indicator v4 SMC / ICT / price actionOscillators & momentum
Updated 2 years ago · None stated GitHub repository of Cerebr Bot
3 stars

Pieki Algo is an all-in-one technical analysis indicator that overlays trading signals, trend visualizers, and Smart Money Concepts onto the main price chart. It plots buy and sell signals based on configurable sensitivity settings, colors candles by trend or

Indicator v5 SMC / ICT / price actionTrend Repaints
Updated 12 months ago · None stated GitHub repository of Pieki Algo Signals & Overlays
2 stars

This indicator plots demand and supply zones computed from volume profile with 30-56 bins, fair value gaps on 4H, and equal highs/lows. It draws a magic line using ATR(14) x 1.618 golden ratio anchored to the 00:00 UTC close. Signals identify liquidity vacuum

Indicator v6 SMC / ICT / price actionVolume
Updated 6 months ago · None stated GitHub repository of Ghost Zone v9 — GTI Signals v18a

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers