Moving Averages

These indicators smooth price into a single “band” series. In strategies, they are used in pairs: a signal triggers when second − first changes sign on a closed bar.

← Back to index

Learning Objectives

Formulas (Plain English)

You don’t need the algebra to use them effectively; understand which are faster vs smoother and pair accordingly.

Fundamentals

Moving averages (MAs) are smoothing filters applied to price to reveal the underlying direction. Increasing the window length yields a smoother line with more lag; decreasing the window makes the MA faster and more sensitive to noise. Choice of weighting (simple vs exponential vs hull) further trades responsiveness against smoothness.

Types (length/offset only)

The following accept length and optional offset. All take close as the primary input unless noted.

{
  "type": "ema",
  "factors": { "length": 21, "offset": 0 }
}

Typical length ranges: fast 7–21; medium 34–55; slow 89–200. Pairing a fast and a slow MA amplifies trend crosses while filtering small wiggles.

In general, higher length produces smoother averages with more lag and fewer signals, while lower length tracks price closely but can whipsaw in consolidation. EMA/HMA/JMA tend to reduce apparent lag at a given length compared to SMA.

Fast vs Slow Cross (Illustration)

Fast vs Slow Moving Average Grey price, blue fast MA, orange slow MA; the fast crosses the slow. Price ↑ Time → Price Fast Slow

Specialized MAs

Beyond SMA/EMA, several variants modify weighting to balance smoothness and responsiveness. HMA reduces lag using a double‑smoothing construction. DEMA/TEMA further increase responsiveness but can overshoot. JMA is designed to minimize lag and noise. SSF applies a digital filter approach to suppress aliasing.

HWMA — Holt‑Winter Moving Average

{
  "type": "hwma",
  "factors": { "na": 0.2, "nb": 0.1, "nc": 0.1, "offset": 0 }
}

SSF — Ehlers Super Smoother Filter

{
  "type": "ssf",
  "factors": { "length": 10, "poles": 2, "offset": 0 }
}

T3 — Tillson T3 Moving Average

{
  "type": "t3",
  "factors": { "length": 8, "a": 0.7, "offset": 0 }
}

Parameters & Implementation Notes

Signals & Execution

A cross signal occurs when the difference (second − first) changes sign between two consecutive closed bars. If the first (often the fast MA) is above the second (slow MA) on the crossing bar, the direction is SHORT; otherwise LONG. Execute at the opening price of the next bar. Avoid using forming bars for decisions.

Common Pitfalls

Recommended presets by interval

These are starting points. Increase the slower baseline for choppy pairs; decrease to trade more frequently.

Offset: Keep 0 for parity. Non‑zero offset is rarely helpful with MAs.

Design Patterns

FAQ

References