Overview
A Triangular Moving Average is an average of data calculated over a period of time, where the middle portion of data has the most weight. The Triangular Moving Average can be used with any price including the Hi, Low, Open, or Close, and can be applied to other indicators too. The Triangular Moving Average smoothens a data series, which is very important in a volatile market as it helps to identify significant trends more easily. Dundas Chart for ASP.NET has four types of moving averages including a Simple, Exponential, Triangular, and Weighted average. The most important difference between the above moving averages is how they weight their datapoints.
Note |
---|
We recommend that you read Using Financial Formulas before proceeding any further. Using Financial Formulas provides a detailed explanation on how to use formulas, and also explains the various options available to you when applying a formula. |
Figure 1: A 20 day Triangular Moving Average, and the High, Low and Closeprices as a stock chart. |
Applying a Triangular Moving Average
All formulas are calculated using the FormulaFinancial method, which accepts the following arguments: a formula name; input value(s); output value(s), and parameter(s) that are specific to the type of formula being applied.
Before applying the FormulaFinancial method, make sure that all data points have their XValue property set, and that their series' XValueIndexed property is set to false.
The following table indicates what sort of FormulaFinancial method arguments to use when calculating a Triangular Moving Average, and also supplies a description of what these parameters mean:
Parameter |
Value/Description |
Example |
---|---|---|
Formula Name: |
TriangularMovingAverage
|
FormulaFinancial(FinancialFormula.TriangularMovingAverage,"20","Series1:Y2","Series2:Y") |
Input Value: | The value for which the triangular moving average has to be calculated. It could be a price like: Hi, Low, Open and Close value. The most used price is the closing value. |
FormulaFinancial(FinancialFormula.TriangularMovingAverage,"20"," Series1:Y2","Series2:Y") |
Output Value: (optional) |
The Triangular Moving average. If not specified output is stored in the first input value. |
FormulaFinancial(FinancialFormula.TriangularMovingAverage,"20","Series1:Y2"," Series2:Y") |
Parameter: |
Period property, used to determine a time period which is used in Triangular moving average. |
FormulaFinancial(FinancialFormula.TriangularMovingAverage,"20","Series1:Y2","Series2:Y") |
A line chart is a good choice when displaying a triangular moving average.
Financial Interpretation: The Triangular moving average is used to compare values with their Triangular moving average, where the Triangular moving average gives more influence to the middle portion of the data.
The most important element used in calculating the moving average is a time period, which should be equal to the observed market cycle.
The Triangular moving average is a lagging indicator, and will always be behind the price. The triangular moving average is calculated as a simple moving average of a simple moving average (represents double smoothing), and because of this is a very slow indicator. When the price is following a trend the Triangular moving average is very close to the price. When a price is increasing the Triangular moving average usually stays down because of the influence of the historical data.
Calculation: To recalculate a Triangular moving average we have to find a middle of the time periods which are used for calculation. This middle point will be calculated differently if the number of periods (i.e. data points) is odd or even.
The triangular moving average will be calculated using a simple moving average for the middle point twice (Moving average of the moving average).
Samples:
This example demonstrates how to calculate a 20 days Triangular Moving average using the Formula method.
Visual Basic | Copy Code |
---|---|
|
C# | Copy Code |
---|---|
|