Moving Average

Calculate moving averages from any numeric data source using seven different smoothing algorithms. The Moving Average rule supports Simple (SMA), Exponential (EMA), Double Exponential (DEMA), Running (RMA), Weighted (WMA), Hull (HMA), and Arnaud Legoux (ALMA) moving averages, making it one of the most versatile building blocks for trend-following and signal-smoothing strategies.

How It Works

The Moving Average rule takes a numeric source value and applies the selected moving average algorithm over a configurable lookback period. On each execution, the rule reads the current source value, adds it to its internal series, and recalculates the average according to the chosen method. The result is a single smoothed value that you can connect to downstream rules for crossover detection, trend filtering, or dynamic support and resistance levels.

The available moving average types each have distinct characteristics:

  • Simple (SMA) — An unweighted arithmetic mean of the last N values. All data points in the window contribute equally.
  • Exponential (EMA) — Applies an exponentially decreasing weight to older values, making it more responsive to recent price changes than the SMA.
  • Double Exponential (DEMA) — Combines two EMAs to reduce lag further, offering faster responsiveness while maintaining smoothness.
  • Running (RMA) — Also known as the Wilder smoothing method, this is a modified EMA commonly used in indicators such as RSI and ATR.
  • Weighted (WMA) — Assigns linearly increasing weights to more recent values, giving the latest data the most influence.
  • Hull (HMA) — Uses weighted moving averages of different periods to produce an extremely smooth, low-lag result ideal for fast-moving markets.
  • Arnaud Legoux (ALMA) — Uses a Gaussian distribution to weight data points, with configurable Shift and Sigma parameters that control the position and width of the weighting curve.

When using the ALMA type, the Shift parameter controls the offset of the Gaussian curve along the data window (0 centres the weight on older data, 1 on newer data, and 0.85 is the standard default), while Sigma controls the width of the curve (higher values produce a broader, smoother average).

If a Base MA Type is specified, the rule first calculates a moving average of the source using the Base MA Type, and then applies the primary MA Type on top of that result. This double-smoothing technique can help reduce noise further in volatile markets.

Inputs

Input Description Required Default
Source The numeric data series to calculate the moving average from. Connect this to any numeric output such as a close price, another indicator value, or a calculated result. Yes
Offset The number of bars to look back into the historical series before returning the value. An offset of 0 returns the current value, 1 returns the previous bar's value, and so on. No 0
MA Type The moving average algorithm to use for the calculation. Available values: Simple, Exponential, Double Exponential, Running, Weighted, Hull, Arnaud Legoux. No Simple
MA Length The number of data points (bars) used in the moving average calculation. Shorter lengths produce faster, more responsive averages; longer lengths produce smoother, more stable averages. No 5
Base MA Type An optional secondary moving average applied to the source before the primary MA Type calculation. When set, the rule performs double-smoothing: first the source is averaged using this type, then the result is averaged again using the primary MA Type. Leave unset for a single moving average calculation. No
Shift Controls the offset of the Gaussian weighting curve for the Arnaud Legoux (ALMA) moving average. A value of 0 centres the weight on older data, 1 centres it on the most recent data, and 0.85 is the standard default that emphasises recent values while retaining some older data influence. Only used when MA Type is set to Arnaud Legoux. No 0.85
Sigma Controls the width of the Gaussian weighting curve for the Arnaud Legoux (ALMA) moving average. Higher values create a broader, smoother curve, while lower values produce a narrower, more concentrated weighting. Only used when MA Type is set to Arnaud Legoux. No 6.0

Outputs

Output Description List
Moving Average The calculated moving average value for the current bar (or the bar specified by the Offset). Connect this to comparison rules, crossover detectors, or other indicators that accept a numeric input. No

Tips

Combine two Moving Average rules with different lengths and connect them to a Compare Switch rule to build a classic moving average crossover strategy. Use a shorter length (such as 5 or 10) for the fast average and a longer length (such as 20 or 50) for the slow average. When the fast average crosses above the slow average, it signals a potential uptrend. For smoother signals in volatile markets, try the Hull or ALMA types, which reduce lag compared to Simple and Exponential averages. You can also use the Base MA Type option to double-smooth the source, which is particularly useful when working with noisy alternative data feeds.

Was this helpful? Let us know