Concept

Triangular MA

Triangular MA is a Trend concept. The Library holds 1 implementation, a working definition you can pull into Quant.

TMA

Top Triangular MA indicator

The top custom implementation, built on the original standard Triangular MA formula.

1 total

Want to trade Triangular MA? The implementation below is one prompt away from a backtested strategy in Quant.

What is a Triangular MA?

A triangular moving average is a simple moving average 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 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. 1Plot 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. 2Verify 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. 3Check 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. 4Read 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. 5Size 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.

TRIMAt=SMA(SMA(P,n/2),n/2+1)\operatorname{TRIMA}_t = \operatorname{SMA}(\operatorname{SMA}(P, \lceil n/2 \rceil), \lfloor n/2 \rfloor + 1)
Equivalently: TRIMAt=i=0n1wi×Ptii=0n1wi\text{Equivalently: } \operatorname{TRIMA}_t = \frac{\sum_{i=0}^{n-1} w_i \times P_{t-i}}{\sum_{i=0}^{n-1} w_i}
wi=min(i+1,ni)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.
  • 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: 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 formalizes, and the TMA's calm keeps the zone from jumping between tests.

Triangular MA vs other smoothing choices

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: 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: 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.

Concept family

Trend

100 concepts mapped · 100 in the Library

Triangular MA FAQ

Turn Triangular MA into a trading strategy.

Take the implementation from this page into Quant, then build on it, backtest it on real data, and keep refining it in conversation.