Triangular moving average
All indicators

LibraryTrend

Indicator

Triangular moving average

A doubly smoothed average whose weights rise towards the middle of the window and fall again, very smooth and slower than an SMA.

TrendOn the price2 inputsTRIMA

How it is calculated

An SMA of an SMA that together cover length bars. For an odd length both are (length + 1) / 2 long, so length 5 weighs the prices 1 2 3 2 1; for an even length one is length / 2 long and the other length / 2 + 1, so length 4 weighs 1 2 2 1. The first value comes once length bars are in, as TA-Lib's TRIMA.

Reference: TA-Lib TRIMA

How to read it

It shows the underlying trend or cycle with little noise but turns late, about half a window after price. Better for seeing the trend than for timing entries.

In a strategy

A slow trend filter, for example longs only while ctx.ind("trima", length=30) is rising, or the centre line for bands of your own.

Inputs

InputTypeDefaultRange or choices
LengthlengthWhole number20min 1, max 5000
SourcesourcePrice"close"close, open, high, low, hl2, hlc3, ohlc4, hlcc4

What it draws

LineDrawn as
TRIMALine

Used in

No strategy template reads it yet.

OrionQuant