The Triangular Moving Average (TRIMA) enhances the smoothing of the simple moving average, proving especially useful in identifying trends amidst volatile market conditions. Unlike the simple moving average, which assigns equal weight to all price points, and the exponential moving average, which prioritizes recent prices, TRIMA focuses more on the middle part of the time series.

TRIMA is a double-smoothed moving average, which might result in a slight delay in trend identification, as entry signals may lag. Nonetheless, it excels in providing more stable exit signals, as it remains unaffected by abrupt market movements.

Just like SMA and EMA, TRIMA is also a trend-following indicator. It can be quite effective when used in conjunction with other indicators or price action techniques.

### Optimal Timeframes

For best results, it’s advisable to apply TRIMA in longer timeframes, such as Daily or Weekly charts.

Further Reading: Elder’s Force Index AFL Code

### Chart Example

The screenshot below displays the triangular moving average on an Amibroker chart, where it is depicted as a blue line overlaying the candlestick chart.

Alongside TRIMA, a simple moving average is also shown as a white line. It’s evident that TRIMA is smoother and responds more gradually compared to the simple moving average.

### Get the TRIMA AFL Code

```				```
"abc","pqr",,"xyz"
```
```

### Understanding the AFL

Upon setting up the chart title and candlestick chart, we compute SMA and TRIMA using these formulas:

SMA = Average (Close, Periods)

TRIMA = Average (SMA, TRIMAPeriods)

Definitions:

SMA = Simple Moving Average

Periods = Time interval for the Simple Moving Average

TRIMAPeriods = Half of the Periods, rounded off

After calculating, SMA and TRIMA are illustrated on the chart using Amibroker’s standard “plot” function. Note that some charting platforms may use identical time periods for both SMA and TRIMA.

Consider these strategies for long and short positions when trading with TRIMA:

• A rising TRIMA suggests an uptrend.
• A falling TRIMA indicates a downtrend.
• Go long if TRIMA crosses above the price.
• Go short if TRIMA crosses below the price.
• Initiate a long position if a lower period TRIMA crosses above a higher period TRIMA.
• Opt for a short position if a lower period TRIMA crosses below a higher period TRIMA.
• Use TRIMA to spot technical divergences between price trends and the indicator. For instance, a price creating a higher high and TRIMA marking a lower high could mean a weakening bullish trend. Conversely, a price hitting a lower low and TRIMA forming a higher low might signal the end of a bearish phase.

### Stock Alpha Calculation in a Spreadsheet: Step by Step Tutorial

dexterDecember 29, 2023

### Machine Learning in Trading: Unlocking the Power of Algorithms

dexterOctober 20, 2023

dexterDecember 29, 2023