OPEN-SOURCE SCRIPT
MA Phase Visualizer

🔹 Logic
This indicator classifies market conditions into six phases based on the relative ordering (rank structure) of three moving averages: Short, Mid, and Long.
All possible permutations of these three moving averages are mapped into background colors, allowing the current structural state of the market to be visualized in real time directly on the chart.
🔹 Phase Definitions
Phases are defined by the relative positioning of the moving averages (Short: S, Mid: M, Long: L):
Phase 1 (Red): S > M > L
Phase 2 (Orange): M > S > L
Phase 3 (Yellow): M > L > S
Phase 4 (Green): L > M > S
Phase 5 (Blue): L > S > M
Phase 6 (Purple): S > L > M
💻 Key Features
1. MA Options
Supports five types of moving averages: SMA, EMA, RMA, WMA, and VWMA, allowing flexible adaptation to different trading styles.
2. Mapping
Each phase is mapped to a distinct background color, enabling intuitive identification of the current market structure.
3. Structural Persistence Tracking
Allows users to visually assess how long a given structural arrangement persists over time.
4. Visual Optimization
Adjustable background transparency (bgAlpha) for improved readability and integration with other chart elements.
💡 Interpretation Guide
1. Trending Market
When Phase 1 (uptrend) or Phase 4 (downtrend) persists over an extended period,
the market can be interpreted as being in a structurally stable trending condition.
2. Structural Transitions
Transitions from Phase 1 or 4 into Phase 2 or 5 represent temporary structural shifts.
Monitoring whether the structure returns to the original phase or progresses into a different phase provides insight into trend continuation or breakdown.
3. Ranging Market (Sideways Condition)
When Phase 1 and 4 appear briefly while Phases 2, 3, 5, and 6 alternate frequently over short intervals, the moving averages are converging, indicating a loss of directional structure and a ranging (sideways) market.
⚠️ Notes
This indicator is designed to visualize market structure through moving average ordering.
It classifies the current market state into one of six structural phases based on the relative position of the Short, Mid, and Long moving averages.
The indicator is intended to support market condition analysis and structural interpretation.
For clarity, the three moving averages used in phase classification are displayed on the chart.
This indicator classifies market conditions into six phases based on the relative ordering (rank structure) of three moving averages: Short, Mid, and Long.
All possible permutations of these three moving averages are mapped into background colors, allowing the current structural state of the market to be visualized in real time directly on the chart.
🔹 Phase Definitions
Phases are defined by the relative positioning of the moving averages (Short: S, Mid: M, Long: L):
Phase 1 (Red): S > M > L
Phase 2 (Orange): M > S > L
Phase 3 (Yellow): M > L > S
Phase 4 (Green): L > M > S
Phase 5 (Blue): L > S > M
Phase 6 (Purple): S > L > M
💻 Key Features
1. MA Options
Supports five types of moving averages: SMA, EMA, RMA, WMA, and VWMA, allowing flexible adaptation to different trading styles.
2. Mapping
Each phase is mapped to a distinct background color, enabling intuitive identification of the current market structure.
3. Structural Persistence Tracking
Allows users to visually assess how long a given structural arrangement persists over time.
4. Visual Optimization
Adjustable background transparency (bgAlpha) for improved readability and integration with other chart elements.
💡 Interpretation Guide
1. Trending Market
When Phase 1 (uptrend) or Phase 4 (downtrend) persists over an extended period,
the market can be interpreted as being in a structurally stable trending condition.
2. Structural Transitions
Transitions from Phase 1 or 4 into Phase 2 or 5 represent temporary structural shifts.
Monitoring whether the structure returns to the original phase or progresses into a different phase provides insight into trend continuation or breakdown.
3. Ranging Market (Sideways Condition)
When Phase 1 and 4 appear briefly while Phases 2, 3, 5, and 6 alternate frequently over short intervals, the moving averages are converging, indicating a loss of directional structure and a ranging (sideways) market.
⚠️ Notes
This indicator is designed to visualize market structure through moving average ordering.
It classifies the current market state into one of six structural phases based on the relative position of the Short, Mid, and Long moving averages.
The indicator is intended to support market condition analysis and structural interpretation.
For clarity, the three moving averages used in phase classification are displayed on the chart.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。