OPEN-SOURCE SCRIPT
MA Distance Monitor

MA Distance Monitor [5 MAs] - Custom
Overview
The MA Distance Monitor is a professional-grade dashboard designed for traders who need to track the relationship between price and multiple Moving Averages simultaneously.
Unlike standard indicators that simply plot lines, this tool quantifies exactly how far the price is from your key levels (in Percentage or Price terms). This is crucial for identifying Mean Reversion opportunities (when price is overextended) and confirming Trend Strength.
Key Features
1. 5 Fully Configurable Moving Averages
Monitor 5 distinct MAs at once.
Default Setup: 5, 10, 20, 50, and 200 SMA (Simple Moving Average) — widely used institutional levels.
Customization: Switch any individual MA between SMA and EMA (Exponential Moving Average) and change lengths to fit your strategy.
2. Smart Dashboard (Clean Mode by Default)
The on-screen table gives you real-time data without cluttering your chart.
Clean Mode: By default, it shows only the Distance %, giving you a minimalist view of market extension.
Expandable: In the settings, you can enable additional columns to see the MA Name, MA Price, and Warning Thresholds.
Borders: Toggle table grid lines on or off for a seamless look.
3. "Overextended" Warning System
Set a specific "Warn %" threshold for each MA (e.g., 5%).
If the price deviates beyond this threshold, the indicator highlights the data in Orange (or your custom color).
Use Case: This helps identify when price has moved too far, too fast, signaling a potential pullback or reversal.
4. Chart Scale Labels
Floating labels appear on the right-side price scale, marking the exact price level of your MAs.
These labels dynamically show the current distance %, keeping your eyes on the price action.
5. Advanced Theming
Dark Mode: High-contrast colors optimized for dark charts.
Light Mode: Optimized for bright backgrounds.
Custom: Fully control every color (Bullish, Bearish, Warning, Text, Headers, Borders) to match your chart aesthetic perfectly.
How to Use
Interpreting the Data
Green: Price is Above the Moving Average (Bullish Trend).
Red: Price is Below the Moving Average (Bearish Trend).
Orange (Warning): Price is Overextended (Distance > Threshold). Watch for mean reversion.
Settings Guide
MA Configuration: Set your Lengths and Types (SMA/EMA).
Display & Styling: * Toggle Show Dashboard Table to hide/view the table.
Toggle Show Table Header or Show Table Borders for layout preference.
Enable Show MA Name or Show MA Price for more detailed data.
Colors: Select "Custom" in the Theme dropdown to apply your own color palette.
Alerts
This script includes built-in alertcondition events for automation:
Crossover: Triggered when Price crosses OVER a specific MA.
Crossunder: Triggered when Price crosses UNDER a specific MA.
To set an alert:
Click the "Alert" button in TradingView.
Select "MA Dist Custom" as the condition.
Choose the specific crossing event (e.g., "Cross Over MA 5").
Created by Psycholfye
Overview
The MA Distance Monitor is a professional-grade dashboard designed for traders who need to track the relationship between price and multiple Moving Averages simultaneously.
Unlike standard indicators that simply plot lines, this tool quantifies exactly how far the price is from your key levels (in Percentage or Price terms). This is crucial for identifying Mean Reversion opportunities (when price is overextended) and confirming Trend Strength.
Key Features
1. 5 Fully Configurable Moving Averages
Monitor 5 distinct MAs at once.
Default Setup: 5, 10, 20, 50, and 200 SMA (Simple Moving Average) — widely used institutional levels.
Customization: Switch any individual MA between SMA and EMA (Exponential Moving Average) and change lengths to fit your strategy.
2. Smart Dashboard (Clean Mode by Default)
The on-screen table gives you real-time data without cluttering your chart.
Clean Mode: By default, it shows only the Distance %, giving you a minimalist view of market extension.
Expandable: In the settings, you can enable additional columns to see the MA Name, MA Price, and Warning Thresholds.
Borders: Toggle table grid lines on or off for a seamless look.
3. "Overextended" Warning System
Set a specific "Warn %" threshold for each MA (e.g., 5%).
If the price deviates beyond this threshold, the indicator highlights the data in Orange (or your custom color).
Use Case: This helps identify when price has moved too far, too fast, signaling a potential pullback or reversal.
4. Chart Scale Labels
Floating labels appear on the right-side price scale, marking the exact price level of your MAs.
These labels dynamically show the current distance %, keeping your eyes on the price action.
5. Advanced Theming
Dark Mode: High-contrast colors optimized for dark charts.
Light Mode: Optimized for bright backgrounds.
Custom: Fully control every color (Bullish, Bearish, Warning, Text, Headers, Borders) to match your chart aesthetic perfectly.
How to Use
Interpreting the Data
Green: Price is Above the Moving Average (Bullish Trend).
Red: Price is Below the Moving Average (Bearish Trend).
Orange (Warning): Price is Overextended (Distance > Threshold). Watch for mean reversion.
Settings Guide
MA Configuration: Set your Lengths and Types (SMA/EMA).
Display & Styling: * Toggle Show Dashboard Table to hide/view the table.
Toggle Show Table Header or Show Table Borders for layout preference.
Enable Show MA Name or Show MA Price for more detailed data.
Colors: Select "Custom" in the Theme dropdown to apply your own color palette.
Alerts
This script includes built-in alertcondition events for automation:
Crossover: Triggered when Price crosses OVER a specific MA.
Crossunder: Triggered when Price crosses UNDER a specific MA.
To set an alert:
Click the "Alert" button in TradingView.
Select "MA Dist Custom" as the condition.
Choose the specific crossing event (e.g., "Cross Over MA 5").
Created by Psycholfye
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。