Multi-cycle Elliott Wave (NEW!)

Real Elliott Wave [MarketFragments]
A top-down Elliott Wave labeler. Instead of forcing a count one swing at a
time, it frames the single dominant swing inside a window of the last N bars
and decomposes it into a 1-2-3-4-5 impulse and an A-B-C correction. The same
decomposition is then recursed into every leg to draw minor and micro
sub-waves, and a confidence score reports how well the structure obeys the
classic Elliott rules. Labels are computed at the right edge and frozen, so
historical labels do not repaint.
This single write-up covers BOTH versions in the post: the ThinkScript (TOS)
study and the TradingView (Pine) indicator. They share the same engine and the
same inputs; the only user-facing difference is that the Pine version adds a
"slope bias" readout to the status label.
─────────────────────────────────────────────────────────────
HOW IT WORKS
─────────────────────────────────────────────────────────────
LAYER 1 -- WINDOW FRAME
The script looks only at the last `lookback` bars (default 100). Inside that
window it finds the highest high and the lowest low and decides direction: if
the low is older than the high the dominant move is UP, otherwise DOWN. The
earlier extreme becomes the ORIGIN (O), the later extreme becomes the END (E).
Everything that follows is a decomposition of that one O -> E swing. This is
why the window is the master control: it decides which swing gets counted.
LAYER 2 -- ZONE-BASED 1-2-3-4-5 DECOMPOSITION
The O -> E leg is split into five waves using non-overlapping search zones
rather than a swing-by-swing loop:
Wave 1 The trend-direction extreme in the first w1ZonePct% of the leg
(default first 35%).
Wave 3 The trend-direction extreme between w1ZonePct% and w3ZonePct%
(default 35%-70%).
Wave 2 The counter-trend pullback extreme STRICTLY between wave 1 and
wave 3 -- it can never collapse onto the same bar as 1 or 3.
Wave 4 The counter-trend pullback extreme STRICTLY between wave 3 and E.
Wave 5 The end of the leg (E itself).
Because wave 3 is searched across the middle band of the whole leg, it can
span many smaller swings and become the longest wave -- the way a real
impulse usually looks. The strict "between" rule on waves 2 and 4 prevents the
common failure where two pivots land on the same candle.
LAYER 3 -- A-B-C CORRECTION
After wave 5, the post-5 leg is scanned for the correction. Wave A is found
first (the first reversal extreme in the first abcAzone% of the post-5 leg),
then C (the correction extreme after A), then B (the bounce strictly between
A and C). If the correction has not yet developed enough bars, C is not drawn
as a confirmed pivot -- instead a projected target labeled "C?" is shown at
the right edge so you can see where the correction is aiming.
LAYER 4 -- MINOR AND MICRO SUB-WAVES (FRACTAL NESTING)
Once the major pivots exist, the exact same decomposition is applied again
inside each major leg:
Motive legs (0-1, 2-3, 4-5, and the motive correction legs)
-> minor i-ii-iii-iv-v
Corrective legs (1-2, 3-4, A-B)
-> minor a-b-c
Turning on Micro subdivides wave 3's motive sub-legs one degree further into
(i)-(iv). Legs shorter than `minorMinBars` are left unlabeled, because a leg
too short to hold a real sub-pattern should not be cluttered with one.
LAYER 5 -- CONFIDENCE SCORE
The count is graded against seven structural Elliott rules:
1 Wave 1 moves in the trend direction
2 Wave 2 does not pass the origin
3 Wave 2 stays inside wave 1
4 Wave 3 exceeds wave 1
5 Wave 4 stays inside wave 3
6 Wave 4 does not overlap wave 2
7 Wave 5 exceeds wave 4
The confidence % is built from how many of the seven rules hold, with a bonus
when wave 3 is the longest wave. The status label colors the result green
(strong), yellow (plausible), or orange (the window probably does not hold one
clean impulse).
─────────────────────────────────────────────────────────────
WHAT YOU SEE ON THE CHART
─────────────────────────────────────────────────────────────
Major 0-1-2-3-4-5 Cyan / aqua bubbles -- the dominant impulse
Major A-B-C Violet / purple bubbles -- the correction after wave 5
"C?" Gray bubble at the right edge -- projected, not yet formed
Minor i-v Gray -- a motive leg subdivided
Minor a-b-c Light gray / silver -- a corrective leg subdivided
Micro (i)-(iv) Dark gray -- 3rd-degree detail inside wave 3 (optional)
Status label Top-left -- direction (UP/DN), confidence %, rules met /7,
whether wave 3 is the longest, and the window size.
The TradingView version also shows a slope-bias readout.
─────────────────────────────────────────────────────────────
READING CONFIDENCE AND TUNING THE COUNT
─────────────────────────────────────────────────────────────
The label is only as good as the window it is reading. If the confidence is
low or the count looks wrong, tune it in this order:
1 ADJUST THE WINDOW FIRST.
Change `lookback` so the window frames ONE clean swing. Too large and it
spans several patterns (confidence drops); too small and there is no room
for five waves. Sweep 200 / 350 / 500 / 1000 and keep the setting with the
best confidence %.
2 IF THE WINDOW ALONE WON'T GET YOU TO 100%, ADJUST THE PIVOT (ZONE) LENGTHS.
`w1ZonePct` and `w3ZonePct` move where waves 1 and 3 are searched, and
`abcAzone` moves where wave A is searched. Make small changes and re-check
the confidence % after each one.
3 CONTROL CLUTTER.
`minSep` and `minorMinBars` decide how much sub-structure is drawn. Raise
them to de-clutter; lower them to label shorter legs.
Color guide: green (>=75) trust it, yellow (55-74) plausible, orange (<55)
re-frame the window before reading anything into the count.
─────────────────────────────────────────────────────────────
PARAMETERS
─────────────────────────────────────────────────────────────
lookback 100 Analysis window in bars -- THE main knob
w1ZonePct 35 Wave 1 searched in the first N% of the leg
w3ZonePct 70 Wave 3 searched between w1ZonePct% and this %
abcAzone 40 Wave A searched in the first N% of the post-5 leg
minSep 4 Min bars between A/B/C to count as "formed"
minorMinBars 4 Min leg length (bars) before minor labels are drawn
showABC on Detect and label the A-B-C correction
showMinor on Draw minor sub-waves (i-v / a-b-c)
showMicro off Draw micro (3rd-degree) detail inside wave 3
showProb on Show the status / confidence label
slopeLen 13 (TradingView only) length for the slope-bias readout
PERFORMANCE: a heavy configuration (minor + micro on a large window) makes the
script re-run many times. If it lags, turn Micro OFF first, then lower
`lookback`.
─────────────────────────────────────────────────────────────
IMPORTANT NOTES
─────────────────────────────────────────────────────────────
-- This is the FIRST version. Additional minor cycles and refinements will be
added in future releases.
-- Suggestions are welcome -- tell us what you would like adjusted in the next
version.
-- The wave-decomposition pathway was verified in Python before being ported
to ThinkScript and Pine.
-- This is a labels-only tool. It is NOT an entry or exit signal.
-- Like any "last-N-bars" analysis, the developing right edge can shift as new
bars arrive while the window slides; closed history is stable on reload.
-- This indicator has not been backtested or forward tested as a trading system.
-- This is not financial advice.
-- Trading involves substantial risk of loss.
-- Use for educational and research purposes only.
─────────────────────────────────────────────────────────────
Free for public use
─────────────────────────────────────────────────────────────

