Distance (Percentage) From 200-day moving average
Aug 22, 2018

The Distance (Percentage) From 200-day moving average indicator quantifies the percentage deviation between the current price and its 200-period exponential moving average to identify overextended market conditions and potential mean reversion points.
Usage
The Usage section describes how the script can be used to analyze market trends and price exhaustion. This indicator serves as an oscillator that fluctuates around a zero line, representing the distance from the selected moving average.
- Identifying Mean Reversion: Traders can observe historical peaks and troughs in the percentage distance to determine levels where the price is likely to "snap back" toward the mean. If the distance reaches an extreme positive or negative value relative to historical data, a reversal or consolidation may be imminent.
- Trend Confirmation: When the indicator stays consistently above zero, it confirms a sustained bullish trend. Conversely, staying below zero confirms a bearish trend.
- Crossover Signals: A crossover of the zero line indicates that the price has crossed the 200-period moving average, signaling a potential shift in the long-term trend.
Details
The script calculates the Exponential Moving Average (EMA) of the closing price based on the user-defined length. Unlike standard distance indicators that provide a raw point value, this tool normalizes the output by calculating the percentage difference: (Price - MA) / MA * 100.
This normalization is critical for comparing volatility and overextension across different assets with varying price scales. The implementation includes a zero-line reference for visual clarity and integrated alerts that trigger when the price crosses the moving average. This version is a refactored iteration of the original concept by ericsolan, optimized for modern charting performance.
Settings
- EMA Length: Determines the lookback period for the exponential moving average calculation. While set to 200 by default for long-term trend analysis, it can be lowered for more sensitive, short-term measurements.
FAQ
What does a positive value represent in this indicator?
A positive value indicates that the current price is trading above the moving average, suggesting bullish momentum. The higher the value, the further the price has stretched away from its average.
Can I use this indicator on timeframes other than the daily chart?
Yes, while it is commonly used on daily charts to track the 200-day MA, the logic applies to any timeframe (e.g., 200-hour or 200-minute MA) to identify deviations from the mean on shorter scales.
How do I get access to the Distance (Percentage) From 200-day moving average?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.