INVITE-ONLY SCRIPT
ZenAlgo - Channel

Overview and required chart interaction
This indicator draws a price channel and a volume profile that are both anchored to a user defined swing range. To initialize it, the user must pick two chart timestamps using the script inputs:
After both points are set, the script analyzes the bars between Start and End, fits a sloped channel through that range, builds a volume profile aligned with the channel, and then projects all derived levels forward along the same slope.
Inputs and what they control
Volume area and profile resolution
Style and visibility
Deviation levels
Slope analysis and alerts
How the channel baseline is constructed from Start to End
Once Start is reached, the script begins accumulating bar-by-bar statistics until End is reached:
Why this works (within the chosen range):
How the channel height is determined and why the borders sit where they do
After computing the baseline slope, the script scans through the selected bars to measure how far price deviated above and below that baseline:
Why this works (and what it implies):
How the volume profile is built inside the channel
The script constructs a volume profile that is aligned with the sloped channel, not a flat horizontal range:
Why this works (and what it measures):
LOC, VAH, and VAL derivation
LOC (line of control)
Interpretation:
VAH and VAL
Interpretation:
Deviation bands around LOC
After LOC is known, the script creates additional parallel bands:
Interpretation:
Optional projections: Extend right and Ghost Extend
Two projection mechanisms exist:
Interpretation:
Pivot labels: HH, HL, LH, LL
The script optionally labels local swing points using pivot detection:
Interpretation:
Breakout detection on channel borders
Once End is set, the channel is considered active and the script evaluates each new bar against the channel borders at that bar index:
Interpretation:
Alerts included by the script
How to interpret the plotted elements together
A practical way to read the indicator is to separate it into three layers of information:
Channel structure
Activity structure inside the channel
Event markers
How to best use this indicator
Selecting Start and End effectively
Using LOC, VAH, and VAL for context
Using breakouts
Combining with pivot labels
Added value over other free indicators
Disclaimers and where the indicator can fall short
This indicator draws a price channel and a volume profile that are both anchored to a user defined swing range. To initialize it, the user must pick two chart timestamps using the script inputs:
- Start - the first anchor point (typically one extreme of the move, such as the swing low for an ascending move or the swing high for a descending move).
- End - the second anchor point (the opposite extreme of that same move).
After both points are set, the script analyzes the bars between Start and End, fits a sloped channel through that range, builds a volume profile aligned with the channel, and then projects all derived levels forward along the same slope.
Inputs and what they control
Volume area and profile resolution
- Width % controls how far the volume profile histogram can extend horizontally. It scales the longest profile bar relative to the Start-End range length.
- Volume Area % controls how much of total volume around the profile’s highest volume region is included when computing the value area boundaries.
Style and visibility
- Toggles exist for displaying the profile derived levels: LOC, VAH/VAL, pivot labels (HH, HL, LH, LL), breakout shapes, and optional ghost extensions.
- Extend lines right decides whether primary lines are truly extended to the right by TradingView’s line extension, or only drawn for the Start-End segment.
- Ghost Extend draws dotted, semi transparent projections for a configurable number of future bars when the main lines are not extended.
Deviation levels
- Deviation Multiplier and Deviation Levels add symmetric bands above and below the LOC, spaced by a distance derived from the channel height relative to LOC. These bands are projected along the channel slope.
Slope analysis and alerts
- The script can evaluate channel "strength" using either angle in degrees or a normalized percent-per-bar slope. The chosen measure is then bucketed into qualitative strength categories that are used only for labeling and alert message context.
- Alerts can be enabled for confirmed breakouts and for slope sign changes (bullish to bearish, or bearish to bullish).
How the channel baseline is constructed from Start to End
Once Start is reached, the script begins accumulating bar-by-bar statistics until End is reached:
- It tracks the number of bars in the selected range and accumulates an average and a linearly weighted average of closes.
- At End, it converts those aggregates into a straight line defined by a start value, an end value, and a per-bar slope across the Start-End period.
Why this works (within the chosen range):
- Using a fitted line over the selected segment provides a compact description of directional drift across that range. It will not capture every fluctuation, but it provides a stable reference for projecting "where the middle of the move is" as time advances.
How the channel height is determined and why the borders sit where they do
After computing the baseline slope, the script scans through the selected bars to measure how far price deviated above and below that baseline:
- For each bar in the range, it computes the baseline value at that bar index and measures the distance from that baseline to the bar’s high and to the bar’s low.
- It finds the maximum upward deviation and the maximum downward deviation.
- The baseline is shifted so the lower channel border is aligned to the worst downward deviation, and the total channel height becomes the distance between the worst upward and worst downward deviations.
Why this works (and what it implies):
- The resulting channel borders are anchored to the extremes observed in the selected range. That makes the borders a description of the range’s realized "envelope" around the fitted drift.
- Because this envelope is derived from past extremes in the chosen window, it is descriptive rather than predictive. When price behavior changes, future price can exceed the historical envelope and will be treated as a breakout.
How the volume profile is built inside the channel
The script constructs a volume profile that is aligned with the sloped channel, not a flat horizontal range:
- The channel’s vertical span is divided into the configured number of bins (Layers).
- For each bar in the selected range, the script checks which bins are intersected by that bar’s high-low range and adds that bar’s volume to each intersected bin.
- It keeps track of the bin with the highest accumulated volume. That bin defines the profile’s maximum-volume region.
Why this works (and what it measures):
- Aggregating volume by where price traded within the channel helps identify the areas where the most activity occurred during the selected move.
- Using bar range intersection (high-low crossing a bin) is a practical approximation for distributing volume across prices without requiring intrabar volume-at-price data. This approximation can over-attribute volume to multiple bins for wide bars, but it remains consistent across the range.
LOC, VAH, and VAL derivation
LOC (line of control)
- The LOC is placed at the center of the highest-volume bin.
- The LOC is then drawn as a line from Start to End, following the same slope as the channel baseline.
Interpretation:
- LOC represents the most frequently traded zone within the selected channel range, expressed as a sloped level that moves forward with the channel’s drift.
VAH and VAL
- Total volume across all bins is computed.
- Starting from the highest-volume bin, the script expands upward and downward, accumulating volume until the accumulated fraction exceeds the configured Volume Area %.
- The highest included bin boundary becomes VAH, and the lowest included bin boundary becomes VAL.
- VAH and VAL are drawn as sloped lines parallel to the channel drift.
Interpretation:
- VAH and VAL bound the portion of the channel where the majority of the range’s volume accumulated, based on the chosen percentage.
- Relative position of price to these levels can be used as context for whether current trading is occurring in historically high-activity or low-activity parts of the selected move.
Deviation bands around LOC
After LOC is known, the script creates additional parallel bands:
- It measures the vertical distance from LOC to the top channel border.
- Using that as a base offset, it draws symmetric lines above and below LOC for each deviation level, scaled by the deviation multiplier.
- These lines are projected with the same slope as the channel.
Interpretation:
- These bands provide repeated "distance markers" above and below LOC in units derived from the selected range’s internal structure.
- They are best treated as contextual zones rather than precise targets, because spacing is tied to the chosen Start-End window and its extremes.
Optional projections: Extend right and Ghost Extend
Two projection mechanisms exist:
- If Extend lines right is enabled, the main channel borders, LOC, and optionally VAH/VAL and deviation lines are extended using TradingView line extension.
- If Extend right is disabled but Ghost Extend is enabled, dotted projections are drawn for a fixed number of future bars from End, including channel borders, LOC, VAH/VAL, and deviation lines.
Interpretation:
- Both options visualize where the same fitted structure would land in future bars if slope remains unchanged. They do not update slope unless Start-End selection is changed.
Pivot labels: HH, HL, LH, LL
The script optionally labels local swing points using pivot detection:
- A pivot high is confirmed when a high is greater than neighboring highs by the configured left and right bar counts.
- A pivot low is confirmed similarly for lows.
- New pivot highs are labeled as HH or LH relative to the prior pivot high, and pivot lows as HL or LL relative to the prior pivot low.
- The logic includes a reset behavior after a new LL or HH to reduce chaining ambiguity across regime shifts.
Interpretation:
- These labels provide local structure context that can be compared to the channel’s direction and to whether price is interacting with channel borders or profile levels.
Breakout detection on channel borders
Once End is set, the channel is considered active and the script evaluates each new bar against the channel borders at that bar index:
- It computes the current top and bottom border values for the present bar by advancing from the Start baseline with the fitted slope and channel height.
- A potential breakout is marked on the first bar that crosses above the top border (or below the bottom border), using a close-based crossing test against the prior bar’s border value.
- After a potential breakout, the script waits for confirmation:
- For an upside breakout, confirmation occurs only if price remains above the top border and then closes higher than the potential breakout close.
- For a downside breakout, confirmation occurs only if price remains below the bottom border and then closes lower than the potential breakout close.
- If price re-enters back inside the border before confirmation, the pending breakout state is canceled.
- For an upside breakout, confirmation occurs only if price remains above the top border and then closes higher than the potential breakout close.
Interpretation:
- The two-step logic distinguishes an initial border cross from follow-through. It aims to reduce cases where a single bar spikes outside the channel and immediately returns.
- The confirmation test is still close-based and does not consider intrabar excursions beyond the channel, so it is sensitive to candle closes rather than wicks.
Alerts included by the script
- Confirmed breakout up or down can trigger alerts and corresponding alertconditions, aligned to the confirmed state described above.
- Slope sign change alert triggers when the computed slope (based on the last selected Start-End range) flips sign compared to the previously computed slope. This is a re-selection or re-computation event rather than a continuous recalculation.
How to interpret the plotted elements together
A practical way to read the indicator is to separate it into three layers of information:
Channel structure
- Top and bottom borders describe the fitted envelope of the selected range.
- The slope indicates the drift direction implied by that selection.
Activity structure inside the channel
- LOC is the highest-activity region within the selected range, projected along drift.
- VAH and VAL bound the configured fraction of volume around the activity center.
- Deviation bands give repeated distance zones around LOC.
Event markers
- Pivot labels show local swing structure.
- Breakout markers highlight border crosses and confirmed follow-through.
How to best use this indicator
Selecting Start and End effectively
- Choose Start and End that represent a coherent swing segment where you want the channel and profile to describe that move.
- Avoid mixing multiple regimes (for example, including both a strong trend and a later choppy distribution) unless that is explicitly what you want the profile to summarize.
- If the selected window is extremely long, the script limits processing to recent data due to a hard cap (it warns when the range exceeds 10,000 bars and uses only the most recent subset).
Using LOC, VAH, and VAL for context
- Treat LOC as the "most traded" zone of the selected move, projected forward.
- Treat VAH and VAL as boundaries of the selected move’s high-activity region. Price acceptance inside VAH-VAL and excursions outside that band can be interpreted as trading in higher-activity versus lower-activity zones of the selected move.
Using breakouts
- A potential breakout is an early warning that the historical envelope is being exceeded on a closing basis.
- A confirmed breakout indicates follow-through beyond the initial breakout close while remaining outside the channel border.
Combining with pivot labels
- Compare HH/HL sequences to the channel slope to understand whether local structure aligns with the selected drift.
- Pivot labels can also help you decide when the current Start-End selection is no longer representative and should be refreshed.
Added value over other free indicators
- The volume profile is constructed along a sloped channel, not a flat horizontal range, so the distribution is expressed in the same coordinate frame as the selected drift.
- LOC, VAH, and VAL are therefore projected parallel to the channel, providing moving reference levels tied to the chosen swing segment rather than static horizontal bands.
- Breakout logic uses a two-step potential and confirmation mechanism, which separates first border crossings from subsequent follow-through conditions.
Disclaimers and where the indicator can fall short
- Results depend heavily on Start and End selection. Different anchor points can produce materially different slope, channel height, and profile levels.
- The volume profile uses candle range intersection to distribute volume across bins. Large range candles can contribute volume to many bins, which may broaden the apparent distribution.
- The channel borders are based on extremes within the selected range. If market volatility expands, price can exceed the envelope frequently and produce repeated breakout states.
- Breakout detection is close-based. Wick-only excursions beyond borders are not treated as breakouts unless the close crosses the border.
- Very large ranges may be truncated for processing due to the script’s internal bar limit, which changes what data is actually summarized.
僅限邀請腳本
僅作者批准的使用者才能訪問此腳本。您需要申請並獲得使用許可,通常需在付款後才能取得。更多詳情,請依照作者以下的指示操作,或直接聯絡ZenAlgo_Official。
TradingView不建議在未完全信任作者並了解其運作方式的情況下購買或使用腳本。您也可以在我們的社群腳本中找到免費的開源替代方案。
作者的說明
Get access here: https://zenalgo.com
The ZenAlgo team
zenalgo.com
discord.zenalgo.com
zenalgo.com
discord.zenalgo.com
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
僅限邀請腳本
僅作者批准的使用者才能訪問此腳本。您需要申請並獲得使用許可,通常需在付款後才能取得。更多詳情,請依照作者以下的指示操作,或直接聯絡ZenAlgo_Official。
TradingView不建議在未完全信任作者並了解其運作方式的情況下購買或使用腳本。您也可以在我們的社群腳本中找到免費的開源替代方案。
作者的說明
Get access here: https://zenalgo.com
The ZenAlgo team
zenalgo.com
discord.zenalgo.com
zenalgo.com
discord.zenalgo.com
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。