已更新

Wyckoff Range Engine [WillyAlgoTrader]

15 493
📊 Wyckoff Range Engine is an overlay indicator that finds Wyckoff accumulation and distribution ranges on any chart and draws them the way the classic schematic does: Support and Resistance lines, plain-text events (SC, AR, ST, Spring, Test, SOS, LPS and their distribution mirrors BC, AR, ST, UTAD, Test, SOW, LPSY), dashed Phase A → B → C → D → E dividers, a measured-move target — and then hands the result to a built-in trade engine with structure-anchored stops, three R-multiple targets, break-even logic and session statistics.

The core insight: Wyckoff events are not single bars, they are swings. A Selling Climax is a swing low at the end of a climactic run; a Spring is a swing that pokes below support and comes back; a Sign of Strength is a whole leg that leaves the range with effort behind it. So the engine first builds a stream of ATR-confirmed swings, attaches effort statistics to every leg, and only then classifies events on that stream. Every range lives in a normalized coordinate (0 = climax side, 1 = reaction side), which means one rule set covers accumulation and distribution without mirroring price.

Everything is evaluated on confirmed bars. Events appear on the swing bar that caused them, the bar where the event became known carries a small "·" marker at the top of the chart, and the trade engine enters on that bar's close.


🧩 WHY THESE COMPONENTS WORK TOGETHER

A volume spike alone is not a climax — it can be a breakout, news, or an expiry print. A support line alone is not a range — it needs a confirmed reaction and a confirmed test to mean anything. And a Spring label without a trade plan is a picture, not a tool.

This indicator chains the pieces so that each one gates the next:

Effort normalization → ATR-reversal swing stream with per-leg statistics → Climactic run walk-back → Climax score (0–100) → Automatic Reaction test → Range container in u-space → Event classifier (ST / Spring / Test / SOS / LPS / UT) → Phase map A–E → Measured-move target + outcome tracking → Trade engine (entry, SL, TP1–3, BE, reversal) → Dashboard + alerts

The effort module turns volume (or bar range when volume is missing) into a ratio against its own baseline, so "heavy" means the same thing on gold, BTC and a small cap. The swing engine confirms turning points only after price closes a full ATR multiple away from the running extreme, and stores the mean effort, peak effort, length and duration of the leg that ended there. The run walk-back collects the chain of lower-highs / lower-lows legs before a candidate low, so the climax is scored on the whole sell-off, not on the last micro-leg. The AR test rejects candidates that never bounce. Once a range exists, u-space turns every later swing into a number between 0 and 1 (or outside it), and the event classifier is a set of inequalities on that number plus leg effort. The phase map is a side effect of the events. The trade engine consumes the event level as its stop anchor.

Without effort normalization the climax score would be symbol-dependent. Without swing statistics there would be no way to say a Spring had "no supply". Without the run walk-back every pullback low in a downtrend would look climactic. Without u-space the accumulation and distribution code paths would drift apart. Without the event-to-stop link the trade engine would be a generic ATR stop bolted onto a label.


🔍 WHAT MAKES IT ORIGINAL

1️⃣ Effort ratio — one scale for every symbol.

Effort source is chosen once per symbol: volume if the feed provides it, otherwise bar range (high − low). Each bar's effort is divided by a simple moving average of the same series:

effort ratio = effort / SMA(effort, 50)

1.0 means a normal bar, 2.0 means twice the usual effort. All thresholds below (climax peak, Spring supply, SOS leg effort) are expressed in this ratio, so the defaults transfer across markets and timeframes. The baseline length is adjustable (Effort Baseline, default 50).

2️⃣ ATR-reversal swing stream with leg statistics.

A swing high is confirmed when a bar closes more than Swing Reversal × ATR below the running high (default 1.0 × ATR(14)); a swing low mirrors this. Every confirmed swing stores the statistics of the leg that ENDED there:

— mean effort ratio over the leg
— peak effort ratio (the heaviest bar)
— leg length in ATR units
— number of bars

The last 60 swings are kept. There are no left/right pivot lookbacks: a swing is final the moment the reversal distance is closed, which is why later events (ST, Test, LPS) confirm as early as the structure allows.

3️⃣ Climactic run walk-back and climax score.

When a new swing low (high) arrives and no range is active, the engine walks back through the swing array while the intermediate highs keep falling (lows keep rising) and every earlier low stays above (below) the candidate. The result is the climactic RUN: its start price, its length in bars and the number of lower lows inside it (the trend-context count, default minimum 2 — a swing-structure replacement for an EMA filter).

Climax score (0–100) is computed on the whole run:

— 30% × clamp(mean run effort − 1.0)
— 30% × clamp((peak bar effort − 1.0) / 3.0)
— 20% × clamp((run length in ATR − 2.0) / 6.0)
— 20% × clamp((run length in ATR / run bars) / 0.5)

Hard gates: peak bar effort ≥ 2.0 × baseline, score ≥ 60, trend context ≥ 2. Only then is the swing marked SC (or BC) and the candidate starts waiting for its reaction.

4️⃣ Automatic Reaction test — a climax without a bounce is not a climax.

The candidate is confirmed as a range only when a reaction-side swing appears that is at least Min Range Height × ATR away (default 3 ATR) AND retraces at least AR Min Retrace of the climactic run (default 50%). Shallow bounces are ignored; a deeper extreme while waiting extends the candidate and adds the extra distance to the run; nothing within Max Bars To Confirm AR (default 60) drops it silently. This single rule removes the instant-fail ranges that appear at every trend bottom in simpler detectors.

5️⃣ u-space — one coordinate for accumulation and distribution.

Every range stores top, bottom and side. Any price p is mapped to

u = (p − bottom) / height for accumulation
u = (top − p) / height for distribution

so u = 0 is always the climax edge, u = 1 the reaction edge, u < 0 beyond the climax side, u > 1 beyond the reaction side. All event rules are written once in u: an ST is a climax-side swing with u ≤ 0.30, an LPS holds u ≥ 0.75, a breakout failure is a close with u < 0.5. There is no mirrored copy of the code for distribution, which keeps both sides consistent by construction.

6️⃣ Phase A extension and the trend guard.

Before the first Secondary Test, a reaction-side swing beyond the range edge is NOT an upthrust — the automatic rally is simply still running. The engine extends the reaction edge (marked "AR+") and keeps the old level as an inner line. If the extended height exceeds Max Range Height (default 8 ATR) the structure is declared a trend, not a range, and the candidate is dropped (gray "NO RANGE · trend"). Likewise a climax-side swing beyond the edge before the first ST only extends the climax extreme (marked "ext") — Springs are a Phase C event and require a prior ST by default.

7️⃣ Spring / UTAD confirmed by the reversal itself, with a supply score.

A climax-side swing with u < 0 in Phase B or later is a Spring (UTAD) candidate. If the confirming bar already closes back inside the range it is a Spring immediately; otherwise it is "pending" and price must close back inside within Reclaim Deadline bars (default 8) or the range is BROKEN. A reaction-side swing forming while a break is pending is a structural break and also closes the range.

Spring score (0–100):

— 40% × clamp(1 − depth in ATR / 1.5) — shallower is better
— 40% × clamp(1 − spring-leg effort / climax-run effort) — less effort than the climax is better
— 20% × clamp(1 − bars to reclaim / 10) — faster reclaim is better

The label tooltip reports "no supply" when the spring leg's mean effort is below 1.0 × baseline, otherwise "shake-out". A Test is the next climax-side swing that holds above the spring low, stays within Test Zone (u ≤ 0.4) and shows less leg effort than the spring leg.

8️⃣ SOS / SOW by the quality of the whole breakout leg.

A Sign of Strength is a close beyond the reaction edge by at least SOS Close Beyond Range × ATR (default 0.1) while the current leg — measured from the last climax-side swing, not from the previous bar — qualifies by effort OR length (switchable to AND):

— mean leg effort ≥ 1.2 × baseline, or
— leg length ≥ 1.5 × ATR

A breakout is only recognised from Phase B on (at least one ST or a Spring), which filters the "breakout" that is really the automatic rally. SOS score = 40% × clamp((leg effort − 1) / 1.5) + 30% × clamp(leg ATR / 3) + 30% × close position within the bar. The measured-move target is set at reaction edge + Target Projection × range height (default 1.0×), drawn as a dashed line for Target Line Extension bars.

9️⃣ LPS / LPSY and breakout failure.

After SOS the first climax-side swing with u ≥ LPS Floor (default 0.75 — upper quarter of the range or above it) within LPS Search Window bars (default 60) is the Last Point of Support. It closes the range as MARKUP (MARKDOWN) and is the default trade entry. A close back below the midline (u < 0.5) before an LPS fails the breakout ("SOS lost"), and the pending target is counted as a miss. If no LPS appears in time the range closes as "MARKUP · no LPS".

🔟 Outcome tracking — the engine grades its own targets.

Every SOS/SOW target is tracked from the bar after the breakout: hit if price touches it before a close back below the midline, miss if the midline is lost first, expired after SOS Outcome Horizon bars (default 120). Targets that are already within Target Must Be Ahead × ATR of the SOS close (default 0.5) are excluded as "passed". The dashboard shows SOS→Target hit rate for the loaded history, plus Spring→SOS and UTAD→SOW follow-through counts. These are descriptive session statistics for the chart you are looking at, not a forecast.

1️⃣1️⃣ Trade engine with structure-anchored stops.

Trade Entry Signal picks the event that opens a position: LPS / LPSY (default), Spring / UTAD, SOS / SOW, or Spring + LPS (an opposite signal reverses, a same-direction signal is ignored — no pyramiding). Entry is the close of the confirmation bar. Stop modes:

— Wick-Anchored: beyond the signal bar's wick + 0.25 × ATR, never closer than 0.5 × ATR
— Structure: beyond the Wyckoff level that produced the signal (LPS swing, spring extreme, range edge) + 0.25 × ATR, min 0.5 × ATR
— ATR: fixed SL Multiplier × ATR

TP1 / TP2 / TP3 are multiples of the ACTUAL stop distance (1R / 2R / 3R in the Balanced preset), so the reward-to-risk is honest regardless of SL mode. Presets: Conservative (SL 2.5 ATR, 1R/2R/4R), Balanced (1.5 ATR, 1R/2R/3R), Aggressive (1.0 ATR, 1.5R/2.5R/4R), Scalping (0.8 ATR, 0.8R/1.5R/2R), Custom. After TP1 the stop moves to break-even (plus an optional ATR offset); a trade is a win once TP1 is touched, a loss if it closes before TP1; TP3 or the stop closes it. Intrabar SL/TP conflicts resolve in favor of TP (optimistic fill model — stated openly in the notes below).


⚙️ HOW IT WORKS — CALCULATION FLOW

Step 1 — Effort: pick volume or bar range once per symbol, compute the bar's effort ratio against its 50-bar baseline, push it to a per-bar buffer used for leg statistics.

Step 2 — Swings: track the running extreme of the current leg; when a close reverses by Swing Reversal × ATR, confirm the swing, compute the finished leg's mean effort, peak effort, ATR length and bar count, and start the next leg from that extreme.

Step 3 — Climax candidate: with no active range, walk back the climactic run from the new swing, score it, apply the peak / score / trend-context gates, mark SC or BC.

Step 4 — Automatic Reaction: wait for a reaction-side swing with ≥ 3 ATR height and ≥ 50% retrace of the run; extend the candidate on deeper extremes; drop it after 60 bars.

Step 5 — Range: create the container (top, bottom, side, climax bar), draw Support / Resistance lines and the range title, enter Phase A.

Step 6 — Bar-level checks on every bar: expiry (Range Lifetime), decisive break beyond the climax edge (Decisive Break Distance × ATR), pending-spring reclaim or deadline, breakout failure below the midline, SOS / SOW test on the current leg, LPS timeout.

Step 7 — Swing-level classification on every new swing: climax side → ext / Spring / pending / Test / ST / LPS; reaction side → AR+ / trend guard / UT-Shakeout / structural break. Each event updates the phase, adds a divider and a text label with a detail tooltip.

Step 8 — Finalize: on close, failed ranges turn gray (or are removed), completed ranges keep their drawings; the last N ranges are kept (Range History Depth).

Step 9 — Trade engine: check SL / TP hits on confirmed bars, apply break-even, close or reverse, open a new position on the chosen entry event, draw Entry / SL / TP lines and labels, update statistics.

Step 10 — Output: dashboard, watermark, alerts.


📖 HOW TO USE

🎯 Quick start:
1. Add the indicator to any chart; leave Effort Source on Auto.
2. Watch for SC / BC text under (over) a swing — that is a candidate waiting for its reaction.
3. When Support / Resistance lines appear, the range is confirmed. Read the title: ACCUMULATION or DISTRIBUTION · Phase X.
4. Plan around the events: ST = range is being tested, Spring / UTAD = Phase C shakeout, SOS / SOW = breakout with effort, LPS / LPSY = the retest that the trade engine enters on.
5. Use the Trade section of the dashboard and the Entry / SL / TP lines for levels; set alerts if you want the same information pushed to you.

👁️ Reading the chart:
— 🟢 Green lines and text = accumulation range, 🔴 red = distribution, gray = failed or expired range (BROKEN, TIMED OUT, NO RANGE · trend)
— Outer lines = the range edges (climax extreme and automatic reaction); thinner inner lines = the first ST level and the pre-extension reaction level
— SC / BC = climax (cyan); AR = automatic reaction; AR+ = reaction extended in Phase A; ext = climax extreme extended before the first ST
— ST = secondary test; Spring / UTAD = climax-side false break that came back (yellow); Test = low-effort retest of the spring
— UT / Shakeout = reaction-side false break after the first ST that did not qualify as a breakout
— SOS / SOW = breakout leg with effort; LPS / LPSY = last point of support / supply; BREAKDOWN / BREAKOUT / SOS lost = failure markers
— Dashed vertical lines with "Phase A … Phase E" captions = phase transitions; "Phase E" is captioned just past the LPS
— Dashed line "Target …" = measured-move projection
— Long ▲ / Short ▼ = trade entry; ENTRY / SL / TP1–TP3 labels with % distance; "SL → BE" = stop moved to break-even; a reached TP turns solid teal with ✓
— "·" at the top of a bar = the bar on which an event became known
— Hover any event label for its score and effort details (Detailed Event Labels prints them on the chart instead)

📊 Dashboard fields:
— Trend: range direction while a range is active, otherwise the last swing vs the one two back
— Phase: Wyckoff phase of the active range, or "Awaiting AR" while a climax candidate waits
— Leg: current leg direction, length in ATR, mean effort, bars (highlighted when effort reaches the SOS threshold)
— Position / Last Signal: trade engine state and the last confirmed signal with its score and age
— Status / Range / Events / Quality: range stage, edges with height in ATR and the close in u, an event checklist (⏳ = pending reclaim), heuristic 0–100 scores
— Spring→SOS / UTAD→SOW: share of ranges whose shakeout was followed by a breakout
— SOS→Target and Outcomes: target hit rate before the midline was lost, hit / miss / expired / pending / passed counts
— Ranges: accumulation and distribution totals with ✓ completed and ✗ broken
— Trade: Long/Short @ price, SL with % (or BE @), TP1–TP3 with ✓, R:R of all three targets, SL distance in %
— Stats (24H / 30D / All-Time): trades, W / L, win rate with gauge, Form strip of the last 10 trades, timeframe

🔧 Tuning guide:
— Too few climaxes: lower Climax Score Threshold (60 → 50) or Climax Peak Bar Effort (2.0 → 1.6); lower Trend Context to 1 on choppy symbols
— Ranges fail right after forming: raise AR Min Retrace or Min Range Height so only solid reactions qualify
— Trend legs get boxed as ranges: lower Max Range Height (8 → 6 ATR)
— Events confirm too late / too early: Swing Reversal 1.0 ATR is the main dial — 0.8 confirms faster with more noise, 1.5 is cleaner and slower
— Breakouts missed: relax SOS Leg Effort / Leg Length or keep the OR logic; false breakouts tagged as SOS: switch to Effort AND leg length
— Stops too tight on fast markets: use the Structure SL mode or the Conservative preset
— Chart too busy: turn off Show Phase Dividers, Show Detection Markers or Show Swing Points; lower Range History Depth


⚙️ KEY SETTINGS

⚙️ Main Settings:
— Effort Source (Auto): volume if available, otherwise bar range
— Effort Baseline (50 bars): SMA length for the effort ratio
— ATR Period (14): ATR used for swings, heights, breaks and scores
— Climax Score Threshold (60): minimum run score for SC / BC
— Climax Peak Bar Effort (2.0): the run must contain a bar this heavy
— Trend Context (2): lower lows (higher highs) required inside the run
— Trade Entry Signal (LPS / LPSY): which event opens a position

〰️ Swing Engine:
— Swing Reversal (1.0 × ATR): reversal distance that confirms a swing

📐 Range Rules:
— AR Min Retrace (0.5): fraction of the climactic run the AR must retrace
— Min Range Height (3 × ATR) and Max Range Height (8 × ATR): acceptable range size; above the max the candidate is a trend
— Max Bars To Confirm AR (60) and Range Lifetime (400 bars)

🧩 Event Rules:
— ST Zone (u ≤ 0.30), Max ST Per Range (3), Spring Needs A Prior ST (on)
— Reclaim Deadline (8 bars), Decisive Break Distance (0.5 × ATR)
— Test Zone (u ≤ 0.4)
— SOS / SOW Leg Effort (1.2), Leg Length (1.5 × ATR), Confirmation (Effort OR leg length), Close Beyond Range (0.1 × ATR)
— LPS / LPSY Floor (u ≥ 0.75), LPS Search Window (60 bars)
— Mark UT / SHAKEOUT (on)
— Target Projection (1.0 × height), Target Line Extension (40 bars), Target Must Be Ahead Of SOS Close (0.5 × ATR), SOS Outcome Horizon (120 bars)

🎨 Visual Settings:
— Theme (Auto / Dark / Light), Show Range Lines, Show Phase Dividers, Show Event Labels, Show Swing Points, Show Buy/Sell Labels, Show Measured-Move Target, Show Detection Markers, Keep Failed / Expired Ranges, Detailed Event Labels, Range History Depth (4), Show Watermark
— Signal / SL-TP / Event label font sizes, Event Label Backdrop (text on a plate in the chart background color)

🛡️ Risk Management:
— Risk Preset (Balanced), SL Mode (Wick-Anchored / ATR / Structure), ATR Length (SL) (14), SL Multiplier (1.5), TP1 / TP2 / TP3 Multiplier (1 / 2 / 3 R, Custom preset)
— Break-Even After TP1 (on), BE Offset (0 × ATR)
— Show SL/TP Lines, Show SL/TP Labels, Show % Distance on Labels, Entry / SL / TP line styles

📊 Dashboard:
— Show Dashboard, Position (Top Right), Font Size, section toggles (Market / Wyckoff / Trade / Stats), Win Rate Period (24 Hours / 30 Days / All-Time)

🔔 Alerts:
— Webhook JSON Format (off), Alert on Wyckoff Events, Alert on SL Hit & Reversal, Alert on TP & Break-Even

🎨 Colors:
— Bull, Bear, Spring/UTAD, Climax, Failure


🔔 ALERTS

— 🟢 LONG / 🔴 SHORT — new entry: ticker, timeframe, price, score, the Wyckoff event behind it, SL, TP1, TP2, TP3, R:R
— 🎯 TP1 HIT / 🎯🎯 TP2 HIT / 🏆 TP3 HIT — direction and the reached level (TP3 also reports the entry)
— 🛡️ BREAK-EVEN — stop moved to break-even, with the new level
— 🛑 SL HIT / 🛡️ BE STOP-OUT — direction, entry and stop level
— 🔄 REVERSAL — opposite signal closed the trade: old → new direction, whether TP1 had been reached, exit price
— ℹ️ WYCKOFF — information alert for every event: climax, AR, ST, Spring / UTAD, Test, SOS / SOW, LPS / LPSY, range failed (suppressed on bars that open or reverse a trade)

Entry alerts are available as plain text or as a JSON payload for webhooks: {"action":"buy","ticker":...,"tf":...,"price":...,"score":...,"sl":...,"tp1":...,"tp2":...,"tp3":...,"rr":...}. Use "Any alert() function call" when creating the alert. All alerts fire once per bar close.


⚠️ IMPORTANT NOTES

— 🚫 No repainting. Every decision is taken on confirmed bars only. Swings are confirmed by a closed reversal of Swing Reversal × ATR, so the swing bar is in the past by the length of the reversal — event labels are placed on that past bar, the "·" marker shows the bar where the event became known, and the trade engine enters on the close of the marker bar. Nothing drawn on confirmed bars moves afterwards; this is delayed confirmation, not repainting of future values.
— 📐 The effort ratio uses volume where the feed provides it and bar range otherwise; on symbols with synthetic or missing volume the Auto mode switches silently — the Leg row of the dashboard tooltip tells you which source is active.
— 📐 Scores (climax, spring, SOS) are heuristic 0–100 rankings for comparing setups on the same chart, not probabilities.
— ⚖️ Session statistics (win rate, Form, SOS→Target, Spring→SOS) describe the loaded chart history, reset on reload or on any input change, and use an optimistic intrabar fill model (TP before SL when both are touched in one bar). They are not a backtest: no commissions, slippage or position sizing. Past performance does not guarantee future results.
— ⚖️ The engine manages one position at a time, enters only on the chosen event and never pyramids; the Spring + LPS mode reverses on an opposite signal.
— 🛠️ This is a market-structure analysis tool, not an automated trading bot. It identifies Wyckoff ranges, events and phases and proposes entry, stop and target levels — trade decisions remain yours.
— 🌐 Works on all markets and timeframes; defaults are expressed in ATR and effort-ratio units and were tuned on intraday and swing charts of liquid instruments. Review the Tuning guide for illiquid symbols.
發行說明
Fixed a few small bugs.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。