All indicators

Functionally Weighted Moving Average

May 9, 2025

Static chart image
Price Action BasedTime BasedMoving Averages

The Functionally Weighted Moving Average (FWMA) indicator is an anchor-able moving average that weights historical prices using mathematical shaping functions to provide more versatile price modeling than conventional moving averages. By utilizing curves like Smoothstep, Ease In/Out, or Cubic Bézier, it allows for highly configurable responsiveness and trend analysis.

Usage

The FWMA can be used as a replacement for standard moving averages (like SMA or EMA) where specific price modeling is required. It is particularly effective for identifying trend initialization and termination by adjusting the "weight" of historical data points within the lookback period.

  • Session Anchoring: Unlike standard moving averages that lag significantly at market opens, the FWMA can be anchored to the first bar of a session. This allows the length to increment from the anchor up to the user-defined maximum, providing faster responses to morning price pivots.
  • Shaping Functions: Users can select different mathematical kernels to change how the average reacts. For example, an "Ease Out" function makes the average more responsive to recent price changes, while "Smoothstep" provides a more balanced, symmetrical weighting.
  • Anchor Saturation: When anchoring is enabled, users can select stabilization modes (Semi Stable or Super Stable) to reduce near-anchor volatility. This makes the average more resistant to erratic price swings immediately following an anchor point.

Details

The FWMA operates by calculating a dot product of price data and a weight array derived from the selected shaping function.

  • Dot Product Synthesis: When the length is incrementing (during the anchoring phase), the indicator synthesizes the dot product by linearly interpolating proportional indices. This ensures the intended shape of the weights is maintained even when historical data is limited.
  • Shaping Math: The indicator uses interpolation functions commonly found in computer graphics. For example, the Smoothstep function creates an S-curve, while the Cubic Bézier option allows for custom curve definition using four coordinate points.
  • Normalization: For a given lookback period, the sum of weights is used as a divisor to ensure the average remains data-faithful. The "Scalar" input allows users to nudge the entire weight range (0 to 1) higher or lower, further refining how "heavy" the historical data feels in the calculation.

Settings

General Settings

  • Length: The maximum number of historical bars to include in the average.
  • Source: The price component used for calculation (e.g., Close, HL2, OHLC4).
  • Offset: Shifts the plot horizontally on the chart.

Shaping Function

  • Weight: Selects the mathematical curve (Linear, Smoothstep, Ease In/Out, etc.).
  • Scalar: Adjusts the weight range. Negative values decrease the weight of historical data, while positive values increase it.
  • Degree 1 & 2: Controls the intensity of the "Ease" functions (how steeply the function curves).
  • Bézier Points: Four sets of XY coordinates that define the shape when "Cubic Bézier" is selected.

Ancillary

  • Session Anchor: Determines if the model resets at the start of a new session and how it stabilizes near that reset point.
  • Divide by intraday timeframe multiplier: When enabled, automatically adjusts length and scalar settings based on the timeframe to maintain a consistent model appearance across different intraday charts.

FAQ

How do I adjust the responsiveness of the FWMA? Responsiveness can be adjusted by changing the "Weight" function (e.g., switching from Smoothstep to Ease Out) or by modifying the "Degree" setting. Higher degrees in easing functions typically make the average more sensitive to recent price action.

What is the benefit of anchoring the moving average? Anchoring allows the moving average to reset at a specific time (like the session open). This prevents price data from the previous day from "pulling" the average away from current price action, which is a common issue with traditional EMAs or SMAs during market opens.

How can I access the Functionally Weighted 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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

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