OPEN-SOURCE SCRIPT

Trend Channel Navigator [MQLSoftware]

9 201
Trend Channel Navigator maps price action as a chain of trend phases, each drawn as its own channel: phase boundaries come from an adaptive swing scanner whose window breathes with the volatility regime, each channel side sits at a quantile of its own deviations instead of a symmetric envelope, a recency-weighted regression tracks the momentum slice inside the active phase, and an original Navigator Entry Score condenses channel position, momentum quality and higher-timeframe agreement into a single 0-100 confluence read - shown live on the panel together with its full component breakdown.

This is a visual analytical tool for chart reading and market-structure context. It does not execute trades and does not provide financial advice.

Key Features
  • Adaptive phase detection: the swing window scales with the volatility regime, so phases are recognized sooner in a heating market and noise swings are ignored in quiet tape
  • Asymmetric quantile channels: each side's width is a percentile of that side's own deviations, so one spike no longer inflates the whole envelope and the top and bottom bands are independent
  • Recency-weighted Micro regression: the newest bars dominate the fit, so the momentum read turns earlier than a uniform regression; a weighted R-squared gate hides it when the fit is poor
  • Navigator Entry Score: a 0-100 confluence read built from four weighted components - macro/micro alignment, channel position, regression fit quality and dual-timeframe agreement
  • Live Score Breakdown on the panel: every component's points are shown next to its budget, so the number is never a black box
  • Scored markers: every structural event (BREAK, PULLBACK, CONTINUATION) prints the matching side of the live score and passes a configurable minimum, and the dedicated ENTRY marker fires when the score crosses your threshold
  • Pullback Zone and Quarter Grid: the favorable quarter of the active channel is shaded and faint quarter lines make Channel Position readable on the chart itself
  • Self-explanatory chart language: markers and labels are written in plain words, every marker and pivot carries an explanatory tooltip, and a Compact mode switches to short codes
  • Non-Repaint Mode on by default: markers fire only on confirmed bars and the active structure is built from closed-bar data


Core Concept

Most channel tools on TradingView take one of two approaches. They fit a single regression channel over the latest N bars, or they draw one channel from manually chosen anchors. Both force all recent history into one line fit, so the chart cannot show where one trend phase ended and the next began.

Trend Channel Navigator treats price as a sequence of structural phases. The phase idea started in our earlier open-source script Anchored Trend Channels; Navigator rebuilds the engine around five mechanisms of its own - the detection, the channel geometry, the momentum fit, the score and its on-chart language all differ from that script.

1. Adaptive phase detection. Swings are found by a strict-extremum scan whose window is re-derived on every bar from the volatility regime - the ratio of short-term ATR to its long baseline. When the market heats up the window contracts and new phases are recognized sooner; in quiet tape it dilates and noise swings never become phases. Builtin pivot functions take a fixed window, which is why the scanner is written by hand. A swing is confirmed a window's worth of bars after it forms, exactly like a classic pivot. When a later swing confirms beyond a phase's endpoint in the same direction - a higher high in an up-phase, a lower low in a down-phase - the phase extends to that new confirmed swing instead of leaving an orphan stretch, so the chain of channels stays continuous.

2. Asymmetric quantile channels. The channel basis is the straight line between the two anchoring swings, which keeps clean joints between phases. The width is not a symmetric envelope: highs above the basis set the top band and lows below it set the bottom band, each at a configurable percentile of its own deviations with an ATR floor. A single spike no longer inflates the whole channel, and a phase that leans on one side of its basis shows that lean honestly.

3. Recency-weighted Micro regression. The inner channel is a weighted least-squares fit in which each bar back weighs a fixed fraction of the previous one, so the newest bars dominate and the momentum read turns earlier than a uniform regression of the same length. The fit quality gate and the residual band use the same weights. Setting the decay to 1.00 reproduces the classic unweighted fit.

4. Navigator Entry Score with a live breakdown. The score is computed independently for the long side and the short side on every bar. Macro and micro direction agreement contributes 35 points, channel position contributes up to 20 and rewards proximity to the favorable edge rather than chasing the far edge, the micro fit quality contributes up to 20, and each of the two higher-timeframe rows contributes 12.5 when it agrees with the side being scored. The panel shows each component's points next to its budget on every bar, so the number is never a black box. An ENTRY marker fires once when the winning side crosses the threshold on a confirmed bar, with its own cooldown; an optional strict mode caps the score below the threshold unless both higher timeframes agree. The other marker families pass through the same score: BREAK, PULLBACK and CONTINUATION print the matching side's value and respect a configurable minimum, so every event on the chart is a scored event.

5. Pullback Zone and Quarter Grid. The score's channel-position component is made visible: the favorable quarter of the active channel is shaded - near the base in an up phase, near the top in a down phase - and faint quarter lines split the channel into the quarters the Channel Position row reads. The channel does not only show where price has been; it shows where the next trend-side read matters.

Anatomy of the Display
Macro channels are the large structures between confirmed swing points. Historical phases are dimmed and frozen; the active phase is bright, carries the shaded Pullback Zone, and extends forward with a dashed projection.

The Micro channel is the smaller regression channel inside the active phase, labelled "Momentum" with its current direction. It shows whether the current momentum slice agrees with the larger phase or is pulling back against it.

Markers name their event in plain words and print the matching side of the live score. BREAK marks a confirmed close beyond the active channel boundary, PULLBACK marks a touch of the favorable edge in trend direction, CONTINUATION marks a micro breakout aligned with the macro phase early in the segment, and ENTRY belongs to the score engine and fires on a threshold cross. Every marker carries a tooltip that explains the event.

The status badge shows the Trend Bias of the recent phases and the live Entry Score with its stronger side.

The panel is the main readout: Trend Bias, active segment angle, direction and age, the chain of recent phases, Channel Position, anchor pivot, channel width in ATR, the last fired event, micro regression metrics, the two higher-timeframe rows, and the live Entry Score against your threshold - followed by the Score Breakdown, where each of the four components shows its current points against its budget.

Multi-Timeframe Panel
The two higher-timeframe rows are selected automatically from a standard ladder based on the chart timeframe, for example 240 and 1D on a 1-hour chart. Higher-timeframe values are requested without lookahead and read with a one-bar offset, so only closed higher-timeframe bars are used. Their agreement is not only displayed - it feeds the Entry Score directly.

Notes on Repainting
  • Historical channels do not repaint intrabar. They are anchored to confirmed swings, and one honest exception is stated openly: when a same-direction swing confirms beyond a phase's endpoint, the completed channel extends to that new confirmed swing and its width is recomputed - on closed data only, at confirmation time. It never moves otherwise.
  • Swing detection carries an inherent delay equal to the current window: a swing becomes visible only after that many bars close past it. With the Adaptive default the window typically resolves to 11-26 bars, tighter in heating markets. This confirmation contract is the same as for all pivot-based tools.
  • Non-Repaint Mode is on by default: the active channel and the micro regression are computed from closed-bar data, so the visible structure does not wobble intrabar. Turning it off lets the active structure update on the live bar for responsiveness; this affects display only.
  • All markers are gated by confirmed bars. ENTRY, BREAK, PULLBACK and CONTINUATION can only appear on the close of their bar and cannot appear or vanish intrabar.
  • Higher-timeframe rows use the standard non-repainting pattern: no lookahead, one-bar offset, closed bars only.
  • The panel and the live score update within the bar. This is display only; no marker or alert is created from an unconfirmed bar.


Typical Analysis Workflow
A common analytical workflow may include:
  1. Reading Trend Bias and the active phase direction first to understand the current structure
  2. Checking Channel Position to see whether price is near the favorable edge or already stretched toward the far edge
  3. Waiting for price to reach the shaded Pullback Zone in the direction of the active phase
  4. Using the Momentum channel and its fit quality to judge whether the current slice is clean enough to trust
  5. Checking the higher-timeframe rows for agreement
  6. Treating the Entry Score as the final confluence read rather than a standalone trade command, and raising the threshold when you want fewer, higher-confluence marks


Configuration
Pivot Sensitivity - Adaptive (default) scales the swing window with the volatility regime; the fixed presets from Short to Very Long and Custom Lookback pin it instead.
Min Segment Size (x ATR) / Min Segment Length (bars) - quality filters that skip noise phases.
Channel Width Multiplier / Min Band Width (x ATR) - how tightly the channel wraps price and the floor under each side's width.
Channel Quantile (%) - the percentile each side's width sits at. 100 reproduces a full envelope; lower values ignore single spikes and hug price tighter.
Max Segments Stored - how many historical phases stay on the chart.
Regression Length / Std Dev Multiplier / Min R2 to Show - the Micro channel window, its band width and its fit gate.
Recency Weight (decay) - how strongly the newest bars dominate the Micro fit. 1.00 = classic unweighted regression.
Segment Break / Macro Pullback / Micro Continuation Signals - enable each marker family independently. Signal Cooldown - minimum bars between same-family markers.
Min Signal Score - structural markers only fire when the matching side of the live score is at least this value. 0 = raw structural events.
Entry Score Threshold - the confluence level an ENTRY marker requires. Require MTF Confluence - strict mode: both higher timeframes must agree for the score to reach the threshold. Entry Cooldown - minimum bars between ENTRY markers.
Non-Repaint Mode - closed-bar data for the active structure (default on).
Line Width / Neon Glow - core line width and the layered glow tier (Off, Subtle, Balanced, Bright).
Show Channel Fills / Show Basis / Show MTF Mini-Screener - display toggles.
Marker Style - Descriptive markers in plain words, or Compact short codes.
Highlight Pullback Zone / Show Quarter Grid - the shaded favorable quarter of the active channel and the faint quarter lines.
Bull / Bear Colors - recolor the whole structure. Defaults are a dark-theme identity; pick deeper tones for light charts.

Markets and Timeframes
The indicator can be applied across multiple markets and timeframes:
  • Forex
  • Stocks and Indices
  • Commodities
  • Cryptocurrencies

Channel widths and segment filters are scaled in ATR rather than in fixed price units, so behaviour stays consistent across instruments. Defaults are tuned for 1H-4H charts; Pivot Sensitivity is the lever for faster or slower timeframes.

Alerts
  • Segment Direction Changed - the active phase flipped direction
  • Segment Break - a confirmed close beyond the active channel boundary
  • Micro Continuation - a micro breakout aligned with the macro phase
  • Entry Score - the score crossed your threshold on a confirmed bar

All alerts evaluate on confirmed bars and respect the same cooldowns and score gates as the chart markers, so an alert fires only when the corresponding marker event fires.

Penafian

Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.