OPEN-SOURCE SCRIPT
Diupdate

Self-Validating Elliott Wave Engine

692
SELF-VALIDATING ELLIOTT WAVE ENGINE

A probabilistic Elliott Wave framework that does three things most wave tools do not: it weighs SEVERAL competing counts at once instead of asserting one, it CALIBRATES its own confidence against what actually happened on the instrument you are viewing, and it tells you honestly when no count is trustworthy. It is decision-support and context - not a signal generator, and never a claim of certainty.


WHY THESE PARTS BELONG TOGETHER (one engine, not a bundle)

Elliott Wave analysis is unavoidably ambiguous: the same swings can support an impulse, a zigzag, a flat or a triangle, and practitioners disagree constantly. A tool that draws one count and hides that ambiguity is misleading. This script is built as a single pipeline whose stages exist specifically to manage that ambiguity, and removing any one stage breaks it:

1. Structure - an alternating swing (ZigZag) series is built from confirmed pivots, and each pivot is tagged with momentum (RSI) and relative volume. This is the raw evidence every wave rule is tested against; without a clean swing series there is nothing to count.

2. Multi-count pattern engine - from that swing series the script forms several competing labelled hypotheses at once (impulse forming wave 3/4/5 or complete, zigzag, flat, contracting triangle). Because Elliott is ambiguous, evaluating alternatives is the whole point, not an add-on.

3. Scoring - each hypothesis is graded on Fibonacci fit, proportion and the alternation guideline (waves 2 and 4 should differ in form), and "wave energy" (does wave 3 thrust hardest, in trend direction, on rising volume?). These are combined deliberately: Fibonacci ratios alone mislabel corrections as impulses; momentum alone is directionless noise; only together do they discriminate real structure.

4. Regime context - a trend/range/compression read (from ADX and ATR) tilts the priors, because impulses are more likely in trends and corrections in ranges. It changes the odds, it does not override the structure.

5. Market-structure confirmation - an independent break-of-structure / change-of-character check raises or lowers the chosen count, so the wave read must agree with raw price action to score well.

6. Calibrated forecast - the forward zone is built from THIS chart's own distribution of historical retracement depths, not fixed ratios pulled from a textbook, so it reflects how the specific instrument actually behaves.

7. Outcome calibration - every forward call (target + invalidation + confidence) is logged and later checked: did price reach target before invalidation? Outcomes are bucketed by confidence, so the confidence number on screen can be mapped to a MEASURED hit-rate. This is the stage that makes the tool self-validating, and it is impossible without all the stages above feeding it.

So the components are not stacked for convenience - they form one loop: build competing hypotheses, score them on structure and momentum, tilt by regime, confirm against price structure, forecast from the instrument's own history, then grade that forecast against reality and report the measured reliability. That is why this is one indicator rather than seven separate overlays.


HOW IT WORKS ON THE CHART

- Wave labels and connecting lines draw the primary (highest-scoring) count's structure.
- A dashed projection line and a shaded forecast zone mark where the primary count expects price to go, with the zone width calibrated from the chart's own retrace history.
- A dashboard reports: the primary count with its probability share, its position and stage, the two best alternative counts, the raw confidence, the measured calibrated hit-rate once enough cases have resolved, the regime, the market-structure state (and whether it confirms or warns), the hard-rule pass/fail, wave energy, an opportunity read (confidence shaped by reward-to-risk and structure), and the target / invalidation levels.


HOW TO USE IT

- Read the ambiguity, not a single answer. The secondary and tertiary counts and their probabilities tell you how clear or murky the structure currently is.
- Trust "Calibrated" over "Confidence". Confidence is the raw structural score; the calibrated figure is the measured success rate for that confidence level on resolved cases - the honest number.
- Respect "stand aside". When confidence is below your threshold the panel says so instead of forcing a count. That is a feature.
- Use target and invalidation as context for your own plan. Invalidation is the level that would break the primary count; the forecast zone is where it expects to resolve. The script places no orders.
- Combine with your own method. The market-structure and regime rows are there so the wave read can be cross-checked against plain price action.


SETTINGS OVERVIEW

- Structure: swing sensitivity (pivot legs), max swings stored, and pivot source - wicks (high/low) or bodies (close), so it suits how you read a given market.
- Scoring weights: Fibonacci fit, proportion/look, wave-3 momentum.
- Context: ADX length and trend threshold.
- Forecast: inner/outer percentiles of the retrace distribution, minimum swings to calibrate, minimum resolved cases before the calibrated hit-rate is trusted.
- Display: minimum confidence for a "clean" count, label/zone/panel toggles, bull/bear colours.
- Alerts: new wave, count flip, invalidation breach, forecast-zone entry (via "Any alert() function call").

Pivot source is selectable and volume is used only when a symbol reports it, so the engine runs on futures, equities, forex, crypto and indices on any timeframe.


ORIGINALITY

Most Elliott tools draw a single count and stop. This one runs a bounded multi-count search, scores each hypothesis on structure plus momentum plus volume, tilts by regime and confirms against market structure, forecasts from the instrument's own retrace distribution, and - uniquely - measures its own realised hit-rate per confidence level so the number on screen is grounded in outcomes rather than asserted. It quantifies and reports its own reliability.


REPAINT NOTICE AND LIMITATIONS (honest)

- Swing detection uses confirmed pivots, which finalise a fixed number of bars after they form. The most recent leg is therefore always provisional and can change. This is inherent to Elliott structure detection and is disclosed deliberately, not hidden.
- Counts are probabilistic hypotheses, not predictions. Two analysts - and this engine on two settings - can read the same chart differently.
- Calibration is a long-run estimate over resolved cases on this chart; early on, and after a regime change, it needs samples before it means anything, and past hit-rate is not a future guarantee.
- This is context and decision-support. It is not a trading system and issues no orders.


DISCLAIMER

This script is for research and education only. It is not financial advice, not a recommendation, and not a solicitation to trade. It places no orders and guarantees no outcome. Markets carry risk; test any tool on your own data and timeframe and make your own decisions.


Catatan Rilis
Bug fixed

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.