OPEN-SOURCE SCRIPT
Impulse Waves & Reversal Zones [MQLSoftware]

Impulse Waves & Reversal Zones is a structural overlay that reads price as a chain of impulse and correction legs, then projects the zone where the dominant trend is expected to resume. Instead of auto-drawing a Fibonacci grid on the latest swing, it first decides whether a leg is a genuine impulse, frames the counter-trend pullback against it, and builds a managed reversal zone with targets, a stop, and a live status that retires the setup once it plays out. A compact right-side panel adds higher-timeframe bias, trend-conviction strength, an alignment score, and a plain-language plan.
This is a visual analytical tool intended for chart reading and structure mapping. It does not execute trades and does not provide financial advice.
Key Features
Core Concept
Most reversal-zone and Fibonacci tools on TradingView take one of two approaches. They either auto-draw a retracement grid on the most recent swing pair (no quality filter, and the grid jumps every time the latest swing redraws), or they label market structure (swings, breaks of structure) without projecting a managed, self-invalidating trade zone. Both leave the reader to decide by hand whether the leg even mattered and where the level should sit.
This indicator builds on a different base: classify structure first, then project a zone only from legs that qualify, and track that zone until it resolves. It adds three specific algorithmic elements on top of that base.
1. Protected-Swing Structure Classification. Trend direction is tracked by a change-of-character state machine with protected swings: the trend only flips when price breaks the swing low or high that launched the prior impulse. Shallow pullbacks therefore stay classified as corrections instead of constantly flipping the trend, which is the common failure mode of naive zigzag and two-pivot tools.
2. Self-Calibrating Impulse Quality Score. Every leg is scored 0-100 as one half Efficiency Ratio (net move divided by the path travelled, i.e. how straight the leg is) and one half Displacement Percentile (the leg's size in ATR units, ranked against the recent distribution of legs). A leg is drawn as an impulse only if it is with-trend and clears the score threshold. Because the size component is ranked against recent legs rather than compared to a fixed pip or point value, the filter self-calibrates across instruments and timeframes with no magic numbers.
3. Conviction-Aware Bias and Reversal Zone. The reversal zone is anchored to the dominant-direction qualified impulse and managed with targets, a stop, and a live state. Higher-timeframe context uses ADX strength rather than a path-efficiency ratio, so a strong trend still reads as strong mid-pullback. When the bias is supported only by ranging higher timeframes, the panel reports the bias but softens the plan to "low conviction" and marks any active setup the same way, so the structural read and the suggested action stay consistent.
Anatomy of the Display
Trend channels are bold green or coral channels drawn only for legs that qualify as impulses. The wave skeleton is a faint thin backbone drawn under every leg, so the raw swing structure stays visible; where a leg qualifies as an impulse, the bold channel sits on top of it.
The correction box is an amber dashed outline on the active counter-trend pullback, labelled with the retracement depth as a percentage of the impulse it is correcting. A retracement beyond 100% is relabelled as a deep retrace because the structure that the zone relied on is now at risk.
The reversal (entry) zone is the filled box spanning the 0.382-0.618 retracement of the qualified impulse, with a dotted mid-line and a label carrying the R:R of the resulting setup. TP1 and TP2 are the 1.272 and 1.618 extensions; the stop sits beyond the impulse origin.
The status chip reads the live state of the setup: waiting for the zone, in the zone, target hit, or stopped. Once the zone is hit or the setup is stopped, the zone and its levels grey out and the chip says so, so a resolved setup is visually retired rather than left looking active.
The right-side panel lists, per row, the timeframe, its bias (Bull / Bear / Flat), and a trend-conviction strength bar. The chart's own row is marked "pullback" when its direction opposes the trading bias, so a green chart row inside a bearish plan reads as the rally you are selling, not as a long signal. Below the rows: an ALIGN score (filled dots for how many higher timeframes vote each way, with the side that has no votes greyed), a verdict (ALIGNED, BULLISH/BEARISH BIAS, or MIXED), and the plan line.
Multi-Timeframe Panel
The higher-timeframe rows are selected automatically from the standard timeframe ladder based on the chart timeframe. For example, a 5m chart reads 15m / 30m / 1H; a 1H chart reads 4H / 1D / 1W; a 4H chart reads 1D / 1W / 1M. Near the top of the ladder fewer than three higher timeframes exist, so the panel simply shows fewer rows (a Daily chart shows Weekly and Monthly; a Weekly chart shows Monthly only). A manual mode lets you pin three timeframes of your choice instead. Higher-timeframe values are read with `lookahead=barmerge.lookahead_off` and a one-bar offset, which is the standard non-repainting pattern for higher-timeframe context.
Notes on Repainting
Typical Analysis Workflow
A common analytical workflow may include:
Configuration
ATR Length - lookback for the ATR used in the swing filter, channel width, and stop placement.
Swing Filter (ATR) - the main noise lever. Higher values keep fewer, larger swings; lower values keep more, smaller swings.
Pivot Left Bars / Pivot Right Bars - the pivot lookback. Right Bars also sets the confirmation delay (a pivot is confirmed this many bars after it forms).
Impulse Strength Min - the minimum quality score (0-100) a with-trend leg must reach to be drawn as an impulse rather than skeleton.
Channel Width (ATR) - the half-width of the impulse channels, in ATR.
Visuals - colors for impulse up/down, correction, entry zone, targets, and stop; toggles for the wave skeleton, entry zone, targets, stop / R:R, and labels.
Multi-Timeframe HUD - show / hide the panel; Auto (next higher timeframes) versus Manual (three chosen timeframes); the three manual timeframes; and panel position (any corner).
Markets and Timeframes
The indicator can be applied across multiple markets and timeframes:
Because the swing filter, channel width, and impulse-size ranking are all ATR-based, the visual behavior stays consistent across instruments and timeframes. The Swing Filter and pivot settings can be tuned per chart for the cleanest read on a given symbol and timeframe.
Alerts
All alerts evaluate on confirmed bars to avoid intra-bar oscillation.
This is a visual analytical tool intended for chart reading and structure mapping. It does not execute trades and does not provide financial advice.
Key Features
- Impulse legs qualified by a self-calibrating quality score and drawn as bold trend channels; weaker legs stay as a faint wave skeleton
- Active correction framed as an amber box labelled with its retracement depth versus the impulse it is correcting (an overrun beyond 100% is flagged as a deep retrace / structure break, not a clean correction)
- Reversal zone built on the 0.382-0.618 retracement of the qualified impulse, with TP1 (x1.272) and TP2 (x1.618) extension targets and a stop with its R:R
- Live setup status that moves through wait, in-zone, target hit, and stopped, and greys the zone out once it is resolved so a played-out setup never lingers as a live opportunity
- Multi-timeframe panel: bias plus trend-conviction (ADX) strength for the chart and the next higher timeframes, an alignment score, and a plain-language plan
- Higher timeframes selected automatically from the standard timeframe ladder based on the chart, with fewer rows near the top of the ladder (Daily, Weekly)
- A plan that softens to "low conviction" when the bias is backed only by ranging higher timeframes, with the active setup flagged the same way so the panel never states two opposite things at once
Core Concept
Most reversal-zone and Fibonacci tools on TradingView take one of two approaches. They either auto-draw a retracement grid on the most recent swing pair (no quality filter, and the grid jumps every time the latest swing redraws), or they label market structure (swings, breaks of structure) without projecting a managed, self-invalidating trade zone. Both leave the reader to decide by hand whether the leg even mattered and where the level should sit.
This indicator builds on a different base: classify structure first, then project a zone only from legs that qualify, and track that zone until it resolves. It adds three specific algorithmic elements on top of that base.
1. Protected-Swing Structure Classification. Trend direction is tracked by a change-of-character state machine with protected swings: the trend only flips when price breaks the swing low or high that launched the prior impulse. Shallow pullbacks therefore stay classified as corrections instead of constantly flipping the trend, which is the common failure mode of naive zigzag and two-pivot tools.
2. Self-Calibrating Impulse Quality Score. Every leg is scored 0-100 as one half Efficiency Ratio (net move divided by the path travelled, i.e. how straight the leg is) and one half Displacement Percentile (the leg's size in ATR units, ranked against the recent distribution of legs). A leg is drawn as an impulse only if it is with-trend and clears the score threshold. Because the size component is ranked against recent legs rather than compared to a fixed pip or point value, the filter self-calibrates across instruments and timeframes with no magic numbers.
3. Conviction-Aware Bias and Reversal Zone. The reversal zone is anchored to the dominant-direction qualified impulse and managed with targets, a stop, and a live state. Higher-timeframe context uses ADX strength rather than a path-efficiency ratio, so a strong trend still reads as strong mid-pullback. When the bias is supported only by ranging higher timeframes, the panel reports the bias but softens the plan to "low conviction" and marks any active setup the same way, so the structural read and the suggested action stay consistent.
Anatomy of the Display
Trend channels are bold green or coral channels drawn only for legs that qualify as impulses. The wave skeleton is a faint thin backbone drawn under every leg, so the raw swing structure stays visible; where a leg qualifies as an impulse, the bold channel sits on top of it.
The correction box is an amber dashed outline on the active counter-trend pullback, labelled with the retracement depth as a percentage of the impulse it is correcting. A retracement beyond 100% is relabelled as a deep retrace because the structure that the zone relied on is now at risk.
The reversal (entry) zone is the filled box spanning the 0.382-0.618 retracement of the qualified impulse, with a dotted mid-line and a label carrying the R:R of the resulting setup. TP1 and TP2 are the 1.272 and 1.618 extensions; the stop sits beyond the impulse origin.
The status chip reads the live state of the setup: waiting for the zone, in the zone, target hit, or stopped. Once the zone is hit or the setup is stopped, the zone and its levels grey out and the chip says so, so a resolved setup is visually retired rather than left looking active.
The right-side panel lists, per row, the timeframe, its bias (Bull / Bear / Flat), and a trend-conviction strength bar. The chart's own row is marked "pullback" when its direction opposes the trading bias, so a green chart row inside a bearish plan reads as the rally you are selling, not as a long signal. Below the rows: an ALIGN score (filled dots for how many higher timeframes vote each way, with the side that has no votes greyed), a verdict (ALIGNED, BULLISH/BEARISH BIAS, or MIXED), and the plan line.
Multi-Timeframe Panel
The higher-timeframe rows are selected automatically from the standard timeframe ladder based on the chart timeframe. For example, a 5m chart reads 15m / 30m / 1H; a 1H chart reads 4H / 1D / 1W; a 4H chart reads 1D / 1W / 1M. Near the top of the ladder fewer than three higher timeframes exist, so the panel simply shows fewer rows (a Daily chart shows Weekly and Monthly; a Weekly chart shows Monthly only). A manual mode lets you pin three timeframes of your choice instead. Higher-timeframe values are read with `lookahead=barmerge.lookahead_off` and a one-bar offset, which is the standard non-repainting pattern for higher-timeframe context.
Notes on Repainting
- Historical impulses and corrections do not repaint. They are built from confirmed pivots (`ta.pivothigh` and `ta.pivotlow` with a right-bars parameter), so once a leg is committed it stays anchored in place.
- The active forming leg is explicitly labelled "forming" and updates as new bars print; the reversal zone itself is anchored to the confirmed pivots of the qualified impulse.
- The setup state is latched. Once price tags the stop or a target, that resolution is recorded against the setup's anchor and does not revert if price later trades back into the zone. A stopped or completed setup cannot revive itself.
- Pivot detection has an inherent delay equal to the right-bars parameter (default 3 bars). A pivot becomes visible only after that many bars close past it. This is a property of all pivot-based indicators, not specific to this script.
- Multi-timeframe panel data uses `lookahead=barmerge.lookahead_off` with a one-bar offset, the canonical non-repainting pattern for higher-timeframe context.
- Alerts are gated by `barstate.isconfirmed` and fire once per closed bar, never intra-bar.
Typical Analysis Workflow
A common analytical workflow may include:
- Reading the panel verdict and plan line to anchor an overall directional view, and noting the conviction (a "low conviction" plan means the bias is real but the higher timeframes are only ranging)
- Checking the ALIGN row and the per-timeframe rows to see whether higher timeframes agree or conflict
- Waiting for the status chip to read in-zone in the direction of the plan (sell rallies into the zone in a down-bias, buy pullbacks in an up-bias)
- Reading the zone label R:R and the TP1 / TP2 / stop levels to frame the trade, then managing it with other forms of analysis and risk management
- Treating the deep-retrace flag and the greyed-out (stopped / target-hit) state as structural context that a setup has changed or ended
Configuration
ATR Length - lookback for the ATR used in the swing filter, channel width, and stop placement.
Swing Filter (ATR) - the main noise lever. Higher values keep fewer, larger swings; lower values keep more, smaller swings.
Pivot Left Bars / Pivot Right Bars - the pivot lookback. Right Bars also sets the confirmation delay (a pivot is confirmed this many bars after it forms).
Impulse Strength Min - the minimum quality score (0-100) a with-trend leg must reach to be drawn as an impulse rather than skeleton.
Channel Width (ATR) - the half-width of the impulse channels, in ATR.
Visuals - colors for impulse up/down, correction, entry zone, targets, and stop; toggles for the wave skeleton, entry zone, targets, stop / R:R, and labels.
Multi-Timeframe HUD - show / hide the panel; Auto (next higher timeframes) versus Manual (three chosen timeframes); the three manual timeframes; and panel position (any corner).
Markets and Timeframes
The indicator can be applied across multiple markets and timeframes:
- Forex
- Stocks and Indices
- Commodities
- Cryptocurrencies
Because the swing filter, channel width, and impulse-size ranking are all ATR-based, the visual behavior stays consistent across instruments and timeframes. The Swing Filter and pivot settings can be tuned per chart for the cleanest read on a given symbol and timeframe.
Alerts
- Price entered entry zone - fires when price first closes inside the reversal zone
- New Swing High - fires when a high pivot is confirmed
- New Swing Low - fires when a low pivot is confirmed
- All higher TFs bullish - fires when every higher-timeframe row is bullish
- All higher TFs bearish - fires when every higher-timeframe row is bearish
All alerts evaluate on confirmed bars to avoid intra-bar oscillation.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
📊 MQLSoftware — Premium TradingView indicators
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
📊 MQLSoftware — Premium TradingView indicators
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน