OPEN-SOURCE SCRIPT
Updated Elliott Wave Detector PRO [TGTBTB]

Elliott Wave Advanced v3 — Validated Wave Counting with Pattern Detection
A word before you start
Elliott Wave is supposedly one of the most powerful frameworks in technical analysis — and also one of the most difficult to apply correctly. The theory involves layers of rules, guidelines, pattern variations, and degree relationships that even experienced practitioners argue about. Automating it is genuinely hard, and no indicator (including this one) will get every count right every time. I felt like banging my head onto my desk more than once while trying to translate the rules into code....
What I tried to do here is capture the core rules and guidelines as faithfully as possible and make them accessible in a way that keeps things honest. The indicator won't show you a wave count unless it actually passes validation. That means you'll sometimes stare at a chart full of dot markers with no labels — and that's a feature, not a bug. I'd rather tell you "I don't know" than confidently show you something wrong.
I've put serious effort into getting the rule enforcement, pattern detection, and Fibonacci relationships right, but Elliott Wave will always involve interpretation. Treat this as a tool that tries to take the objective parts of the theory off your shoulders so you can focus on the parts that require judgment.
I deliberately made this indicator open source because I am not an Elliott Wave expert. So if you notice anything that is absolutely wrong according to the rulebook of Elliott Wave leave a message below or contact me directly so I can bug fix this indicator. The goal is to make Elliott Wave theory accessible to everyone.
What differentiates this indicator from other Elliot Wave indicators
This indicator attempts to solve the biggest problem with Elliott Wave analysis on charts: most auto-labelers just slap wave numbers onto every swing without checking if the count is actually valid.
Elliott Wave theory has three rules that cannot be broken. Ever. If your wave count violates any of them, it's wrong — no discussion. This indicator enforces all three before putting a single label on your chart:
1. Wave 2 never retraces beyond the start of Wave 1
2. Wave 3 is never the shortest among waves 1, 3, and 5
3. Wave 4 does not enter Wave 1's price territory (unless it's a diagonal)
If the pivots on your chart don't satisfy these rules, you won't see wave numbers — you'll see neutral dot markers instead. That's intentional. I'd rather show you nothing than show you a wrong count. Too many indicators out there label every zig-zag as "wave 3" and give people false confidence. This one stays quiet when it's not sure.
Pattern Detection
The indicator identifies five pattern types:
Impulse (5-wave motive) — Five alternating swings validated against all three cardinal rules, with confidence scoring based on Fibonacci proportions between the waves. Wave 3 at 1.618x Wave 1 - a high-confidence impulse. Wave 3 barely longer than Wave 1? Still valid, but lower confidence, which gets reflected by the score
Diagonal (Leading / Ending) — Same five-wave structure, but with the key difference that Wave 4 overlaps Wave 1. The indicator checks for a converging wedge shape and progressively shorter waves. These show up at the start or end of larger wave sequences and are easy to miscount as impulses if you're not checking for overlap.
Zigzag (A-B-C sharp correction) — Three-wave correction where Wave B typically retraces 38-79% of Wave A, and Wave C often equals Wave A in length. The indicator validates B doesn't exceed A's origin and C reaches beyond A's end.
Flat (Regular & Expanded) — Wave B retraces almost all of Wave A (or exceeds it in an expanded flat), and Wave C approximates Wave A's length. The indicator distinguishes between regular flats (B ≈ 100% of A) and expanded flats (B > 105% of A) because they have different trading implications.
Contracting Triangle (A-B-C-D-E) — Five-wave sideways pattern with converging boundaries. Each successive wave should be shorter than the previous one. The indicator checks that highs are declining and lows are rising, and requires at least 3 out of 4 contraction relationships to hold (real markets aren't always perfectly geometric).
Guidelines
Elliott Wave has rules (hard constraints) and guidelines (soft constraints that affect probability). This indicator checks both of them:
Alternation — If Wave 2 is a sharp, deep correction, Wave 4 should be a shallow, sideways one, and vice versa. The indicator classifies each correction based on retracement depth and duration relative to the preceding impulse, then checks whether waves 2 and 4 have different character. This isn't a dealbreaker if it fails, but it affects the confidence score and is shown on the info panel (✓ or ✗).
Sub-wave structure — Motive waves (1, 3, 5) should subdivide into 5 sub-waves internally, while corrective waves (2, 4) should subdivide into 3. The indicator counts secondary pivots within each primary wave's time range and checks if the internal structure is consistent with what Elliott Wave theory expects. Again, not a hard gate, but it influences confidence scoring.
Fibonacci Analysis
The Fibonacci levels are calculated with proper anchor points:
Retracements are projected from the last completed wave — showing where the current correction might find support/resistance.
Extensions use the correct Elliott Wave method: the prior impulse wave's length is projected from the corrective wave's end. So if you've completed waves 1-2, the Wave 3 target is projected as a 1.618 extension of Wave 1's length measured from Wave 2's end. Not from some arbitrary reference point.
When a validated pattern exists, the extension anchors are taken directly from the identified wave structure. When there's no confirmed pattern, it falls back to geometric pivot-based projection (and tells you so).
The Forecast Panel
I made a deliberate design choice for this: the forecast is gated behind pattern confirmation.
If the indicator has identified a validated impulse, zigzag, flat, triangle, or diagonal, the forecast panel shows "CONFIRMED" and provides wave-structure-aware targets and scenarios. After a completed correction, it projects the next impulse in the correct direction. After a completed impulse, it anticipates the corrective phase.
If no pattern has been validated, the forecast shows "UNCONFIRMED" and limits itself to cautious directional observations based on raw pivot geometry. No wave labels, no "Wave 3 starting!" claims, but a honest reporting of what the price structure looks like without pretending to know more than it does.
The projection lines on the chart reflect this too — confirmed forecasts get solid, visible projections; unconfirmed ones are thinner and more transparent.
Trade Signals
Three signal types, all requiring some degree of pattern confirmation:
-Wave 3 Entry — Fires after a valid Wave 2 retracement (38.2-78.6%) when the indicator has at least moderate confidence in the count
- Wave 5 Exit — Triggers when momentum is waning in a confirmed impulse (last wave significantly shorter than the overall move)
- Wave C Reversal — Signals when a validated zigzag or flat correction is complete and the reversal should begin
Signals won't fire on an unconfirmed wave count. If the indicator isn't sure what wave you're in, it won't pretend to give you entries.
Settings & Tuning
Swing Detection — The two most important inputs. "Primary Wave Swing Length" controls how many bars are needed to confirm a major swing (lower = more sensitive, more pivots, more patterns detected but potentially noisier). "Min Swing %" sets the minimum percentage move to qualify as a primary wave — for crypto on daily timeframes, 5-10% works well. For forex or equities you'll want to bring this down.
Sub-Wave Swing Length — Controls the secondary pivot detection used for internal structure validation. Keep this lower than the primary setting.
Everything else in the settings is display-related and fairly self-explanatory. Colors, text sizes, which elements to show/hide.
What this is NOT
This is not a crystal ball. Elliott Wave analysis is inherently subjective — two analysts can look at the same chart and produce different valid counts. What this indicator does is enforce the objective constraints of the theory and give you a probabilistic assessment of which pattern best fits the current structure.
It works best on higher timeframes (4H, Daily, Weekly) where the swing structure is cleaner. On 1-minute charts you'll mostly see dot markers because the noise rarely resolves into validated patterns — and that's the indicator doing its job correctly.
Use it alongside your other analysis. The wave count gives you context for where you are in the cycle. The Fibonacci levels give you targets. The signals give you timing. But none of it replaces risk management and position sizing.
A word before you start
Elliott Wave is supposedly one of the most powerful frameworks in technical analysis — and also one of the most difficult to apply correctly. The theory involves layers of rules, guidelines, pattern variations, and degree relationships that even experienced practitioners argue about. Automating it is genuinely hard, and no indicator (including this one) will get every count right every time. I felt like banging my head onto my desk more than once while trying to translate the rules into code....
What I tried to do here is capture the core rules and guidelines as faithfully as possible and make them accessible in a way that keeps things honest. The indicator won't show you a wave count unless it actually passes validation. That means you'll sometimes stare at a chart full of dot markers with no labels — and that's a feature, not a bug. I'd rather tell you "I don't know" than confidently show you something wrong.
I've put serious effort into getting the rule enforcement, pattern detection, and Fibonacci relationships right, but Elliott Wave will always involve interpretation. Treat this as a tool that tries to take the objective parts of the theory off your shoulders so you can focus on the parts that require judgment.
I deliberately made this indicator open source because I am not an Elliott Wave expert. So if you notice anything that is absolutely wrong according to the rulebook of Elliott Wave leave a message below or contact me directly so I can bug fix this indicator. The goal is to make Elliott Wave theory accessible to everyone.
What differentiates this indicator from other Elliot Wave indicators
This indicator attempts to solve the biggest problem with Elliott Wave analysis on charts: most auto-labelers just slap wave numbers onto every swing without checking if the count is actually valid.
Elliott Wave theory has three rules that cannot be broken. Ever. If your wave count violates any of them, it's wrong — no discussion. This indicator enforces all three before putting a single label on your chart:
1. Wave 2 never retraces beyond the start of Wave 1
2. Wave 3 is never the shortest among waves 1, 3, and 5
3. Wave 4 does not enter Wave 1's price territory (unless it's a diagonal)
If the pivots on your chart don't satisfy these rules, you won't see wave numbers — you'll see neutral dot markers instead. That's intentional. I'd rather show you nothing than show you a wrong count. Too many indicators out there label every zig-zag as "wave 3" and give people false confidence. This one stays quiet when it's not sure.
Pattern Detection
The indicator identifies five pattern types:
Impulse (5-wave motive) — Five alternating swings validated against all three cardinal rules, with confidence scoring based on Fibonacci proportions between the waves. Wave 3 at 1.618x Wave 1 - a high-confidence impulse. Wave 3 barely longer than Wave 1? Still valid, but lower confidence, which gets reflected by the score
Diagonal (Leading / Ending) — Same five-wave structure, but with the key difference that Wave 4 overlaps Wave 1. The indicator checks for a converging wedge shape and progressively shorter waves. These show up at the start or end of larger wave sequences and are easy to miscount as impulses if you're not checking for overlap.
Zigzag (A-B-C sharp correction) — Three-wave correction where Wave B typically retraces 38-79% of Wave A, and Wave C often equals Wave A in length. The indicator validates B doesn't exceed A's origin and C reaches beyond A's end.
Flat (Regular & Expanded) — Wave B retraces almost all of Wave A (or exceeds it in an expanded flat), and Wave C approximates Wave A's length. The indicator distinguishes between regular flats (B ≈ 100% of A) and expanded flats (B > 105% of A) because they have different trading implications.
Contracting Triangle (A-B-C-D-E) — Five-wave sideways pattern with converging boundaries. Each successive wave should be shorter than the previous one. The indicator checks that highs are declining and lows are rising, and requires at least 3 out of 4 contraction relationships to hold (real markets aren't always perfectly geometric).
Guidelines
Elliott Wave has rules (hard constraints) and guidelines (soft constraints that affect probability). This indicator checks both of them:
Alternation — If Wave 2 is a sharp, deep correction, Wave 4 should be a shallow, sideways one, and vice versa. The indicator classifies each correction based on retracement depth and duration relative to the preceding impulse, then checks whether waves 2 and 4 have different character. This isn't a dealbreaker if it fails, but it affects the confidence score and is shown on the info panel (✓ or ✗).
Sub-wave structure — Motive waves (1, 3, 5) should subdivide into 5 sub-waves internally, while corrective waves (2, 4) should subdivide into 3. The indicator counts secondary pivots within each primary wave's time range and checks if the internal structure is consistent with what Elliott Wave theory expects. Again, not a hard gate, but it influences confidence scoring.
Fibonacci Analysis
The Fibonacci levels are calculated with proper anchor points:
Retracements are projected from the last completed wave — showing where the current correction might find support/resistance.
Extensions use the correct Elliott Wave method: the prior impulse wave's length is projected from the corrective wave's end. So if you've completed waves 1-2, the Wave 3 target is projected as a 1.618 extension of Wave 1's length measured from Wave 2's end. Not from some arbitrary reference point.
When a validated pattern exists, the extension anchors are taken directly from the identified wave structure. When there's no confirmed pattern, it falls back to geometric pivot-based projection (and tells you so).
The Forecast Panel
I made a deliberate design choice for this: the forecast is gated behind pattern confirmation.
If the indicator has identified a validated impulse, zigzag, flat, triangle, or diagonal, the forecast panel shows "CONFIRMED" and provides wave-structure-aware targets and scenarios. After a completed correction, it projects the next impulse in the correct direction. After a completed impulse, it anticipates the corrective phase.
If no pattern has been validated, the forecast shows "UNCONFIRMED" and limits itself to cautious directional observations based on raw pivot geometry. No wave labels, no "Wave 3 starting!" claims, but a honest reporting of what the price structure looks like without pretending to know more than it does.
The projection lines on the chart reflect this too — confirmed forecasts get solid, visible projections; unconfirmed ones are thinner and more transparent.
Trade Signals
Three signal types, all requiring some degree of pattern confirmation:
-Wave 3 Entry — Fires after a valid Wave 2 retracement (38.2-78.6%) when the indicator has at least moderate confidence in the count
- Wave 5 Exit — Triggers when momentum is waning in a confirmed impulse (last wave significantly shorter than the overall move)
- Wave C Reversal — Signals when a validated zigzag or flat correction is complete and the reversal should begin
Signals won't fire on an unconfirmed wave count. If the indicator isn't sure what wave you're in, it won't pretend to give you entries.
Settings & Tuning
Swing Detection — The two most important inputs. "Primary Wave Swing Length" controls how many bars are needed to confirm a major swing (lower = more sensitive, more pivots, more patterns detected but potentially noisier). "Min Swing %" sets the minimum percentage move to qualify as a primary wave — for crypto on daily timeframes, 5-10% works well. For forex or equities you'll want to bring this down.
Sub-Wave Swing Length — Controls the secondary pivot detection used for internal structure validation. Keep this lower than the primary setting.
Everything else in the settings is display-related and fairly self-explanatory. Colors, text sizes, which elements to show/hide.
What this is NOT
This is not a crystal ball. Elliott Wave analysis is inherently subjective — two analysts can look at the same chart and produce different valid counts. What this indicator does is enforce the objective constraints of the theory and give you a probabilistic assessment of which pattern best fits the current structure.
It works best on higher timeframes (4H, Daily, Weekly) where the swing structure is cleaner. On 1-minute charts you'll mostly see dot markers because the noise rarely resolves into validated patterns — and that's the indicator doing its job correctly.
Use it alongside your other analysis. The wave count gives you context for where you are in the cycle. The Fibonacci levels give you targets. The signals give you timing. But none of it replaces risk management and position sizing.
Release Notes
Big Update: Automatic Multi-timeframe AnalysisWHAT'S NEW IN v3.1?
This update adds Multi-Timeframe (MTF) wave analysis — the most requested feature since v3 launched. The core idea: higher timeframe wave context validates your current timeframe count. If the Daily says you're in a wave 3 impulse, your 1H chart should be showing nested motive structure. If it's not, the indicator tells you.
MTF FEATURES
Dual Higher Timeframe Analysis
The indicator now runs Elliott Wave pattern detection on two higher timeframes simultaneously and cross-references the results with your current chart's wave count.
Auto-Detect Mode (enabled by default)
No more guessing which HTF to use. The indicator automatically selects sensible higher timeframes based on your chart:
• 1m–5m chart → 1H + 4H
• 15m–1H chart → 4H + Daily
• 4H chart → Daily + Weekly
• Daily chart → Weekly + Monthly
Asset-Aware Parameter Scaling
HTF swing sensitivity auto-adjusts based on what you're trading:
• Crypto → 5.0% min swing (high volatility)
• Stocks → 3.5%
• Indices/CFDs → 2.5%
• Forex → 1.0% (tight ranges)
Swing length and percentage also scale with the HTF resolution — fewer bars needed on Weekly vs 4H because each candle covers more ground.
Alignment Scoring
A new alignment engine compares your current timeframe pattern with both HTFs across two dimensions:
— Direction: Are CTF and HTF pointing the same way?
— Phase coherence: Is a CTF correction happening inside an HTF impulse (normal), or is a CTF impulse fighting an HTF corrective structure (weaker)?
The result is a score from -1.0 (full conflict) to +1.0 (full alignment) displayed as ALIGNED / PARTIAL / NEUTRAL / CONFLICTING in the info panel.
Confidence Adjustment
CTF wave confidence is boosted when HTFs align and penalized when they conflict. The weight is configurable (default 20%) — set it to 0 to see MTF context without it affecting your scores.
Signal Gating
Trade signals (Wave 3 entry, Wave C reversal) are automatically suppressed when MTF alignment reads CONFLICTING. This prevents entries against the higher degree structure.
Enhanced Forecast
The forecast panel now includes MTF context notes:
✓ HTF trend supports entry
⚠ Counter-trend to HTF
⚠ HTF opposes correction thesis
Star ratings adjust up or down based on HTF agreement.
New Alerts
• MTF Aligned — fires when multi-timeframe alignment is confirmed alongside a validated CTF pattern (high conviction)
• MTF Conflict — fires when HTFs disagree with the CTF count (caution signal)
HOW IT WORKS
1. HTF pivots are collected via request.security() from both higher timeframes using the same alternating swing logic as the primary wave detection
2. Full pattern detection (impulse, diagonal, zigzag, flat, triangle) runs on HTF pivot arrays — if no EW pattern validates, it falls back to trend structure classification (HH/HL vs LH/LL)
3. Results feed into the alignment engine which modifies CTF confidence and gates trade signals
4. Everything is displayed in an expanded info panel with dedicated MTF rows
SETTINGS
All MTF settings live under the "Multi-Timeframe Analysis" input group:
• Enable MTF Validation — master toggle
• Auto-Detect HTF from Chart — on by default; disable to set timeframes manually
• Manual HTF 1 / HTF 2 — only active when auto-detect is off
• HTF Swing Length / Min Swing % — auto-scaled by asset class; manual override available
• HTF Confidence Weight — how much alignment affects CTF confidence (0–50%, default 20%)
• Show HTF Pivot Markers — optional: draw HTF swing points on your chart
TIPS
• The info panel shows the detected asset class and resolved swing parameters so you can verify auto-detect is choosing sensibly
• For crypto on lower timeframes, the default parameters work well out of the box
• For forex, auto-detect drops the min swing to 1.0% — if you're still not getting enough HTF pivots, try lowering further in manual mode
• Load maximum chart history (Chart Settings → Symbol → Max bars back) to give the higher timeframes more data to work with
• The Weekly/Monthly HTFs need time to accumulate pivots — expect "RANGING" or low confidence readings on those until enough swings have formed
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.