OPEN-SOURCE SCRIPT
MSC - Market Structure Channels - Trend & Corrective Channel

MSC- Market Structure Channels — Trend & Corrective Channel
Main Trend Channel + Corrective Channel + Breakout Detection
This indicator detects and plots dynamic price channels based on pivot structure, separating the market into two structural layers:
• Main trend channels – define the primary directional structure of the market
• Corrective channels – detect temporary pullbacks within the main trend
The goal of the indicator is to visually separate trend structure and correction structure, allowing traders to better identify continuation phases and potential breakout moments.
How the Indicator Works
The script uses pivot-based structure detection to build channels from confirmed swing points.
Main Channel Detection
The main channel is created when the script detects a valid structural move:
Uptrend channel
• two rising pivot lows
• a confirmed high between them
• sufficient touches of the channel boundaries
Downtrend channel
• two falling pivot highs
• a confirmed low between them
• sufficient boundary touches
The channel is drawn using:
• Base line – trend structure line
• Parallel line – projected channel boundary
• Midline (optional) – center of the channel
Historical channels can optionally remain visible with reduced opacity.
Corrective Channel Detection
When a main channel exists, the script looks for counter-trend corrective channels inside the main structure.
For example:
Inside a main uptrend
• the indicator searches for descending corrective channels
Inside a main downtrend
• the indicator searches for ascending corrective channels
A corrective channel is only considered valid when:
• it remains inside the main channel structure
• it contains a minimum number of touches
• pivot points form a valid counter-trend slope
This allows the script to isolate pullbacks inside a trend, rather than random micro channels.
Breakout Signals
Optional breakout signals appear when price breaks a corrective channel boundary.
These breakouts often indicate:
• potential trend continuation
• the end of a pullback phase
Bullish breakout condition:
Price closes above the upper boundary of a corrective bearish channel
Bearish breakout condition:
Price closes below the lower boundary of a corrective bullish channel
Signals can be turned on or off in the settings.
Indicator Features
• Automatic main trend channel detection
• Automatic corrective channel detection inside the trend
• Optional midline visualization
• Channel history display with transparency control
• Breakout signal detection from corrective channels
• ATR-based tolerance for detecting channel touches
• Adjustable pivot sensitivity
Key Inputs
Main Pivot Length
Controls sensitivity of the primary trend structure.
Corrective Pivot Length
Controls sensitivity of corrective channel detection.
Touch Tolerance (ATR)
Defines how close price must be to a channel boundary to count as a touch.
Min Channel Touches
Minimum number of contacts required to validate a channel.
Extend Bars
Controls how far channels extend into the future.
Notes
• The script uses confirmed pivots, so channels appear after the pivot confirmation period.
• Channel detection is structure-based rather than predictive.
• Breakout signals depend on the presence of a valid corrective channel.
Typical Usage
Traders can use the indicator to:
• identify the dominant trend channel
• visualize pullback structures within the trend
• monitor breakouts from corrective channels
• observe how price behaves around channel boundaries and midlines
The indicator is designed as a visual structure tool, not as a standalone trading system.
Main Trend Channel + Corrective Channel + Breakout Detection
This indicator detects and plots dynamic price channels based on pivot structure, separating the market into two structural layers:
• Main trend channels – define the primary directional structure of the market
• Corrective channels – detect temporary pullbacks within the main trend
The goal of the indicator is to visually separate trend structure and correction structure, allowing traders to better identify continuation phases and potential breakout moments.
How the Indicator Works
The script uses pivot-based structure detection to build channels from confirmed swing points.
Main Channel Detection
The main channel is created when the script detects a valid structural move:
Uptrend channel
• two rising pivot lows
• a confirmed high between them
• sufficient touches of the channel boundaries
Downtrend channel
• two falling pivot highs
• a confirmed low between them
• sufficient boundary touches
The channel is drawn using:
• Base line – trend structure line
• Parallel line – projected channel boundary
• Midline (optional) – center of the channel
Historical channels can optionally remain visible with reduced opacity.
Corrective Channel Detection
When a main channel exists, the script looks for counter-trend corrective channels inside the main structure.
For example:
Inside a main uptrend
• the indicator searches for descending corrective channels
Inside a main downtrend
• the indicator searches for ascending corrective channels
A corrective channel is only considered valid when:
• it remains inside the main channel structure
• it contains a minimum number of touches
• pivot points form a valid counter-trend slope
This allows the script to isolate pullbacks inside a trend, rather than random micro channels.
Breakout Signals
Optional breakout signals appear when price breaks a corrective channel boundary.
These breakouts often indicate:
• potential trend continuation
• the end of a pullback phase
Bullish breakout condition:
Price closes above the upper boundary of a corrective bearish channel
Bearish breakout condition:
Price closes below the lower boundary of a corrective bullish channel
Signals can be turned on or off in the settings.
Indicator Features
• Automatic main trend channel detection
• Automatic corrective channel detection inside the trend
• Optional midline visualization
• Channel history display with transparency control
• Breakout signal detection from corrective channels
• ATR-based tolerance for detecting channel touches
• Adjustable pivot sensitivity
Key Inputs
Main Pivot Length
Controls sensitivity of the primary trend structure.
Corrective Pivot Length
Controls sensitivity of corrective channel detection.
Touch Tolerance (ATR)
Defines how close price must be to a channel boundary to count as a touch.
Min Channel Touches
Minimum number of contacts required to validate a channel.
Extend Bars
Controls how far channels extend into the future.
Notes
• The script uses confirmed pivots, so channels appear after the pivot confirmation period.
• Channel detection is structure-based rather than predictive.
• Breakout signals depend on the presence of a valid corrective channel.
Typical Usage
Traders can use the indicator to:
• identify the dominant trend channel
• visualize pullback structures within the trend
• monitor breakouts from corrective channels
• observe how price behaves around channel boundaries and midlines
The indicator is designed as a visual structure tool, not as a standalone trading system.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
Free telegram channel t.me/alexmasterforex
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
Free telegram channel t.me/alexmasterforex
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。