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
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.