Moving Average Contrarian Indicator
May 26, 2023

The Moving Average Contrarian Indicator tool identifies potential market turning points by measuring and normalizing the distance between price and a moving average to highlight overextended sentiment.
Usage
The Usage section describes how the script can be used to identify trend exhaustion and potential reversals. The indicator oscillates between 0 and 100, where extreme values suggest the price is significantly stretched from its mean.
- Bullish Reversals: When the MACI value is above its Signal Line (SMA) and exceeds the 30 threshold, the indicator highlights potential bullish conditions with green bars and backgrounds.
- Bearish Reversals: When the MACI value is below its Signal Line and falls below the 70 threshold, it highlights potential bearish conditions with red bars and backgrounds.
- Neutral States: When the indicator is between thresholds or lacks momentum relative to its average, it displays neutral coloring (yellow/chart foreground), suggesting consolidation or a transitional phase.
Traders can also utilize the MACI to spot Divergences. For example, if price reaches a higher high while the MACI reaches a lower high, it may indicate a bearish divergence and a possible trend exhaustion.
Details
The Moving Average Contrarian Indicator (MACI) is constructed through a multi-step normalization process:
- Mean Calculation: A Simple Moving Average (SMA) is calculated based on the user-defined length.
- Distance Measurement: The raw distance between the current price and the SMA is determined.
- Normalization: This distance is normalized using the highest and lowest distances observed over the lookback period. This converts the value into a 0–100 range, making it easier to compare overbought and oversold conditions regardless of the asset's price.
- Smoothing: A second SMA is applied to the MACI value itself to act as a signal line for crossover detection.
Settings
- Moving Average Length: Determines the period used for the underlying moving average and the normalization lookback. Shorter lengths increase sensitivity for short-term reversals, while longer lengths provide smoother signals for long-term trend analysis.
FAQ
How do I interpret the histogram colors?
Green indicates bullish momentum where the MACI is above its signal line and the oversold threshold. Red indicates bearish momentum where the MACI is below its signal line and the overbought threshold. Neutral colors indicate a lack of clear directional bias.
Can this indicator be used in sideways markets?
The MACI is most effective in trending markets. In sideways or choppy conditions, the indicator may produce frequent signals as price oscillates closely around its mean; therefore, it is recommended to use it alongside other technical analysis tools.
How do I access the Moving Average Contrarian Indicator?
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.