All indicators

Percent above or Below Moving Average Candle colour

Aug 24, 2022

Static chart image
SignalsCandlestickMoving Averages

The Percent Above or Below Moving Average indicator identifies significant price deviations from a baseline average by dynamically coloring candles based on their percentage distance from a user-defined Moving Average.

Usage

The Usage section describes how the script can be used to filter price action and identify potential overextensions or trend strength.

Trend Filtering

Users can utilize the indicator to highlight bars that exhibit strong momentum away from the mean. By setting a specific percentage threshold, the script isolates candles where a significant portion of the price range sits above or below the Moving Average, helping traders identify breakout strength or exhaustive moves.

Color Modes

The script features two distinct coloring modes that change how the indicator interprets price data:

  • Selective: This mode only colors candles that meet the specific percentage threshold requirement. A green candle is highlighted if its distance above the MA exceeds the threshold, while a red candle is highlighted if its distance below the MA exceeds it.
  • All: This mode provides a continuous trend bias by coloring all candles based on whether they are simply above or below the Moving Average.

Details

The indicator calculates a Moving Average based on the user's preferred type and source. It then evaluates the relationship between the candle's high/low range and the Moving Average value.

The core logic uses a percentage-based filter: for a bullish signal, it checks if the distance between the high and the MA is greater than a specific percentage of the candle's total range (High - Low). This ensures that the coloring is relative to the volatility of the specific bar, rather than a fixed point distance. The script supports multiple Moving Average types, including SMA, EMA, SMMA (RMA), WMA, and VWMA, allowing for various smoothing techniques depending on the market environment.

Settings

Moving Average Settings

  • Moving Average Length: Determines the lookback period used to calculate the baseline average.
  • MA Type: Allows the selection of the smoothing algorithm (SMA, EMA, SMMA, WMA, or VWMA).
  • Source: Specifies which price data (Close, Open, High, Low, etc.) is used to calculate the Moving Average.

Calculation & Visuals

  • % Above/Below: Sets the percentage threshold (0-100) required to trigger a color change in "Selective" mode.
  • Color Mode: Toggles between "Selective" (threshold-based coloring) and "All" (position-based coloring).

FAQ

How can I adjust the sensitivity of the signals? You can increase the sensitivity by lowering the "% Above/Below" value or shortening the "Moving Average Length." Higher percentage values will result in fewer, more exclusive candle highlights.

Which Moving Average type is best for reducing lag? The EMA (Exponential Moving Average) or WMA (Weighted Moving Average) are generally preferred for reducing lag as they place more weight on recent price data compared to the SMA.

How do I access this 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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.