TriAverage (Function)
The TriAverage series function places the majority of the weighting on the middle portion of the specified length.
Syntax
TriAverage(Price, Length)
Returns (Double)
A numeric value containing the Triangular Moving Average for the current bar.
Parameters
Name |
Type |
Description |
Price |
Numeric |
Specifies which bar value (price, function, or formula) to use. |
Length |
Numeric |
Sets the number of bars to consider. |
Remarks
In calculating the Triangular Average, the Average is inherently double-smoothed.
Examples
Assigns to Value1 the Triangular Moving Average based on the Close of the last 14 bars:
Value1 = TriAverage(Close, 14);
Assigns to Value2 the Triangular Moving Average based on the High of the last 21 bars.
Value2 = TriAverage(High, 21);
Additional Example
If you wanted to place a Buy on Close order when the Close crossed above the Triangular Moving Average, you could use the following syntax:
If Close Crosses Above TriAverage(Close, 18) Then
Buy This Bar on Close;