Trendlines are a crucial tool in technical analysis for identifying and confirming trends. A straight line connecting two or more price points, a trendline can act as a line of resistance or support in future. Basically, trendlines are used to depict trends in data and to examine problems of prediction. Commonly used with financial charts, these lines can be used with diversified technical analysis charts, for instance MACD (moving average convergence/divergence) that is a trading indicator used in technical analysis of stock prices, or RSI (relative strength index) that is a technical indicator used in the analysis of financial markets.
The supported FitTypes can be set using the FitType property that accepts the following values from the FitType enumeration. Each trend type is drawn based on the calculation formula of its type.
Type |
Description |
---|---|
Average X | Calculates the average value of X from the chart data and draws a trendline. |
Average Y | Calculates the average value of Y from the chart data and draws a trendline. |
Exponential | A curved line that is convenient to use when data values rise or fall at increasingly higher rates. You cannot create an exponential trendline if your data contains zero or negative values. |
Fourier | A way to display a wave like function as a combination of simple sine waves. It is created by using the Fourier series formula. |
Linear | A linear trendline is a best-fit straight light. Your data is linear if the data point pattern resembles a line, and a linear trendline is a good fit if the R-squared value is at or near 1. |
Logarithmic | A best fit curved line used for better visualization of data. Used when the rate of change in the data increases or decreases quickly and then levels out. It can also use positive and negative values. |
Max X | Takes the maximum value of X from the chart and draws a trendline using it. |
Max Y | Takes the maximum value of Y from the chart and draws a trendline using it. |
Min X | Takes the minimum value of X from the chart and draws a trendline using it. |
Min Y | Takes the minimum value of Y from the chart and draws a trendline using it |
Polynomial | A twisted line that is used when data oscillates. It is useful for analyzing gains and losses over a large data set. |
Power | A curved line that is best used with data sets that compare calculation that increase at a peculiar rate. For example, the acceleration of a vehicle at one-second intervals. |
Create a Trendline instance, and set properties, such as FitType, Order, and SampleCount of the Trendline class. Add the trendline instance to the Series collection.