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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Free telegram channel t.me/alexmasterforex
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Free telegram channel t.me/alexmasterforex
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.