All indicators

Parametric Corrective Linear Moving Averages

Jan 27, 2020

Static chart image
SignalsMoving Averages

The Parametric Corrective Linear Moving Averages tool provides a versatile dual-moving average system based on a Parametric Rectified Linear Unit (PReLU) weighting function to control lag and overshoot. It offers users granular control over the impulse response of the indicator, allowing for the creation of low-lag "corrective" filters or more smoothed signal lines for crossover strategies.

Usage

The Usage section describes how the script can be used, primarily for identifying trend reversals and momentum shifts through crossovers. The indicator plots two distinct lines: a "Trigger" (typically set to be more responsive/low-lag) and a "Signal" (typically more lagging).

  • Trend Following: Users can identify bullish trends when the Trigger line crosses above the Signal line and bearish trends when it crosses below.
  • Lag Management: By adjusting the percentage of negative weights, users can transform the moving average from a standard Linearly Weighted Moving Average (WMA) into a highly responsive corrective filter similar to a Least Squares Moving Average (LSMA).
  • Overshoot Control: The "Corrective Factor" allows users to dampen the "overshoot" effect (where the average exceeds price during sharp moves) often found in low-lag filters.

Details

The script utilizes a Parametric Rectified Linear Unit (PReLU) as its weighting function. In digital signal processing, the impulse response of a filter determines its characteristics; this script allows users to modify that response parametrically.

A "corrective" moving average is one that applies negative weights to older data points to reduce phase lag. By using the PReLU function—where weights for $x > 0$ remain linear and weights for $x < 0$ are scaled by an alpha factor—the script can create a variety of weight distributions. For example, setting the negative weight percentage to 33.33% effectively approximates the behavior of a Least Squares Moving Average (LSMA). The Signal line is generated by reversing this weighting function, ensuring it naturally lags behind the Trigger.

Settings

  • Length: Sets the lookback period for the moving averages. Higher values increase smoothing but add lag.
  • Source: Determines the price data used for calculation (e.g., Close, Open, HL2).
  • Percentage Of Negative Weights: Controls the proportion of the lookback window that receives negative weighting. This directly affects the "correctivity" or lag reduction of the Trigger line. Capped at 50% to maintain the relationship between Trigger and Signal.
  • Corrective Factor: Equivalent to the alpha parameter in a PReLU function. It determines the steepness of the negative weight line. Lower values (near 0) reduce overshoots, while higher values (near 1) provide stronger lag compensation.

FAQ

What is a corrective moving average? A corrective moving average is a filter that uses negative weights on older data points to reduce the inherent lag found in standard smoothing calculations.

How can I make the indicator mimic an LSMA? To estimate a Least Squares Moving Average, set the "Percentage of Negative Weights" to 33.33 and the "Corrective Factor" to 1.0.

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.