# Triangular MA

A Trend concept (Moving-average lineage) in the LuxAlgo Library, with 1 indicator implementation.

## What is a Triangular MA?

A triangular moving average is a [simple moving average](https://www.luxalgo.com/library/concept/sma/) smoothed a second time: an SMA of an SMA, with each pass covering roughly half the stated period (platforms differ on how odd lengths are split, so two implementations can disagree slightly at the same setting). Running two near-equal windows back to back makes the combined weights form a triangle across the lookback, heaviest at the middle of the window and tapering toward zero at both ends.

That center-weighting is the opposite of front-loaded schemes like the [WMA](https://www.luxalgo.com/library/concept/wma/) or EMA, which concentrate weight on the newest bars. The TMA is therefore one of the smoothest fixed-window averages and one of the least responsive: recent bars carry as little weight as the oldest ones, so the line turns well after price does. It is best treated as a slow trend backbone rather than a signal line.

Formally, triangular weights are what convolving two equal rectangular windows produces, which is why the TMA can be computed either as a weighted average with triangle-shaped weights or as two SMA passes. The double pass also improves the filter's behavior against short cycles: a single SMA lets a surprising amount of fast ripple leak through, while the squared response of two passes suppresses it, which is why triangular smoothing appears inside other tools. LuxAlgo's Triangular Momentum Oscillator applies it to momentum before hunting divergences, and standalone implementations by everget and cheatcountry (the latter an Ehlers-style triangle average) keep the raw line in circulation.

The cost is delay, and how much depends on the construction. Splitting the stated period into two half-length passes gives lag in the same neighborhood as a full-length SMA with a much smoother trace; running two full-length passes roughly doubles the delay. Centered variants, popular in forex as the basis of "TMA channel" tools, shift the line back half a window so it hugs the data, but their recent portion is recalculated as new bars arrive, and signals taken from the moving end describe a line that will not look the same tomorrow. For anything actionable, the non-centered version is the honest choice.

## How to identify a Triangular MA on charts

A TMA looks like an unusually calm simple moving average, so identification is mostly about confirming the construction and choosing the variant that suits the job.

1. Plot a TMA and a simple moving average of the same stated period side by side: the TMA should trace a visibly smoother path that turns slightly later at swings.
2. Verify the construction by charting an SMA of an SMA at roughly half the period each; if the lines coincide, the platform uses the standard split (odd periods can differ by a bar's worth of weighting).
3. Check whether the version is centered or non-centered by watching recent bars: a centered TMA keeps redrawing its right end as new data arrives, a standard one does not.
4. Read the slope rather than price crossings: the line's turn points, infrequent by design, are the signal it actually offers, much like a dedicated slope filter on a slower average.
5. Size the period to the trend you care about, then confirm on history that the line stays one-directional through moves you would want to hold and only bends at swings that mattered.

## How it's calculated

A doubly smoothed average that weights the middle of the lookback window most heavily.

```
TRIMA_t = SMA(SMA(P, ceil(n / 2)), floor(n / 2) + 1)
Equivalently: TRIMA_t = Σ_{i=0..n-1} (w_i × P_{t-i}) / Σ_{i=0..n-1} w_i
w_i = min(i + 1, n - i)

  P_t: source price at bar t (default close)
  t: bar index
  n: TRIMA length in bars (no universal default; 20 and 30 are common)
  SMA(x, m): simple moving average of series x over m bars
  ceil(x), floor(x): x rounded up, or down, to the nearest integer
  i: offset back from the current bar, 0 to n - 1
  w_i: triangular weight at offset i, largest in the middle of the window
  TRIMA_t: triangular moving average at bar t
```

The double SMA and the triangular weight forms are identical; for odd n both SMA lengths reduce to (n + 1) / 2, for even n they are n / 2 and n / 2 + 1, matching TA-Lib.

Because weight peaks at the window center, TRIMA is smoother but laggier than an SMA of the same length.

## How traders use it

- As a smooth directional filter: the TMA's slope carries most of its information, and because the line rarely wiggles, slope flips are infrequent enough to gate faster entry logic, a use closely related to the [MA slope filter](https://www.luxalgo.com/library/concept/ma-slope-filter/).
- As the midline for bands and channels: some envelope-style tools are centered on a TMA precisely because the midline stays calm, so changes in band width reflect volatility rather than midline noise.
- As an internal smoothing stage: some oscillator and momentum designs pass their raw series through triangular smoothing to suppress bar-to-bar noise before signal rules are applied.
- As the slow leg in [moving average crossovers](https://www.luxalgo.com/library/concept/moving-average-crossovers/): pairing a fast EMA with a TMA produces fewer, later crosses than two front-loaded averages, which suits systems that would rather miss the first leg of a move than churn through a range.
- As a pullback zone in trends: because the line is slow to bend, price in a healthy trend tends to return to it cleanly, the behavior [dynamic S/R via MA](https://www.luxalgo.com/library/concept/dynamic-s-r-via-ma/) formalizes, and the TMA's calm keeps the zone from jumping between tests.

## Triangular MA vs other smoothing choices

- **SMA** (https://www.luxalgo.com/library/concept/sma/): Equal weights against triangle weights over the same window. The SMA responds a little sooner and jitters more, and its output can jump when a large old bar drops out of the window; the TMA's tapered ends fade old bars out gradually instead.
- **EMA** (https://www.luxalgo.com/library/concept/ema/): An EMA piles weight on the newest bars and never entirely forgets the old ones, so it hugs price and turns quickly. The TMA does the opposite, weighting the middle of its window most heavily. Fast signal legs favor the EMA; calm baselines favor the triangle.
- **Ehlers SuperSmoother** (https://www.luxalgo.com/library/concept/ehlers-supersmoother/): Both aim at smoothness, but the SuperSmoother comes from filter theory and is designed to cut high-frequency noise with less lag than window averaging, at the cost of occasional slight overshoot. The TMA is simpler to reason about and always stays within the range of its inputs.

## FAQ

### Is a triangular moving average just a double-smoothed SMA?

Yes. Taking an SMA of an SMA, with both passes near half the stated period, produces the same result as a single weighted average whose weights rise linearly to the window's midpoint and fall symmetrically after it. Conventions differ on splitting odd periods, which is why TMA values can vary slightly between platforms at identical settings.

### Why do some triangular moving average tools repaint?

Centered variants shift the TMA back by half its window so the weight peak sits over the bars being averaged. Near the right edge those values depend on bars that have not printed yet, so they keep redrawing as new data arrives. The standard, non-centered TMA does not repaint; it simply lags.

### What period should I use for a triangular moving average?

There is no universal setting. The stated period should cover the swing you want to ride: intraday trend backbones often run 20 to 50 bars, while position-trade baselines run longer. Because the TMA is smoother than an SMA at the same length, some users shorten the period a step to recover responsiveness. Test on your own market rather than importing defaults.

### Does a TMA lag more than other moving averages?

At the same stated period, a TMA built from two half-length passes has delay comparable to a plain SMA while plotting much smoother; versions running two full-length passes roughly double the lag. Either way it responds later than an EMA or WMA of similar length, which is the deliberate trade: the line gives up timing to gain stability.

### Is the TMA good for trading signals on its own?

Rarely. Its crossings with price happen long after turns, and in ranges the line sits mid-chop while price whips both sides of it. It earns its place as a regime and baseline tool: slope for direction, distance from the line for stretch, and a calm midline for envelopes, with entries timed by faster tools.

### Why do TMA bands look so accurate on historical charts?

The popular band versions are usually built on a centered TMA, which plots each value half a window back and recalculates its recent portion as bars arrive. Historical bands therefore wrap price with hindsight built in, while the live end keeps shifting. Non-centered TMA bands do not repaint; they simply lag like the average they wrap.

## Implementations in the Library

- Triangular Momentum Oscillator & Real Time Divergences (LuxAlgo): https://www.luxalgo.com/library/indicator/triangular-momentum-oscillator-real-time-divergences/

## Related concepts

- SMA: https://www.luxalgo.com/library/concept/sma/
- EMA: https://www.luxalgo.com/library/concept/ema/
- Adaptive-lookback MA: https://www.luxalgo.com/library/concept/adaptive-lookback-ma/
- MA Envelope: https://www.luxalgo.com/library/concept/ma-envelope/
- SWMA: https://www.luxalgo.com/library/concept/swma/
- RMA: https://www.luxalgo.com/library/concept/rma/
- HMA: https://www.luxalgo.com/library/concept/hma/
- KAMA: https://www.luxalgo.com/library/concept/kama/
- JMA: https://www.luxalgo.com/library/concept/jma/
- ZLEMA: https://www.luxalgo.com/library/concept/zlema/

---

Source: https://www.luxalgo.com/library/concept/triangular-ma/ (LuxAlgo Library, the encyclopedia of trading & technical analysis). Free to use with attribution: https://www.luxalgo.com/library/license/