Skip to main content

Trend Lines

  • 2 minutes to read

A Trend Line is an indicator presented by a line drawn through two data points of a series.

TrendLines

How to Add a Trend Line to a Chart

The following markup shows how to add two trend lines to a chart:

<dxc:StockSeries2D.Indicators>
    <dxc:TrendLine x:Name="trendLine1"
                Argument1="6/26/2016"
                ValueLevel1="High"
                Argument2="7/31/2016"
                ValueLevel2="High"
                ExtrapolateToInfinity="False"
                LegendText="Resistance Trend Line"
                ShowInLegend="True"/>
    <dxc:TrendLine x:Name="trendLine2"
                Argument1="6/1/2016"
                ValueLevel1="Low"
                Argument2="6/26/2016"
                ValueLevel2="Low"                 
                LegendText="Support Trend Line"
                ShowInLegend="True"/>
</dxc:StockSeries2D.Indicators>

The table lists classes and properties required to draw trend lines:

Class or Property Description
XYSeries2D.Indicators Provides access to the collection of indicators that belong to the current series.
TrendLine Represents an individual Trend Line.
FinancialIndicator.Argument1 Gets or sets an argument of the first financial indicator’s point.
FinancialIndicator.ValueLevel1 Gets or sets a value indicating how to obtain the first value of a financial indicator’s point.
FinancialIndicator.Argument2 Gets or sets an argument of the second financial indicator’s point.
FinancialIndicator.ValueLevel2 Gets or sets a value indicating how to obtain the second value of a financial indicator’s point.
TrendLine.ExtrapolateToInfinity Specifies whether the Trend Line is extrapolated to infinity.
TrendLine.ExtrapolateToNegativeInfinity Specifies whether the Trend Line is extrapolated to negative infinity.
Indicator.LegendText Gets or sets the text that identifies the indicator within the legend of a chart control.
Indicator.ShowInLegend Specifies whether the indicator (Fibonacci Indicators, Regression Lines, Moving Average and Envelope or Trend Lines) is represented in the chart’s legend.

Tip

Set the Indicator.Visible property to false when you need to hide a trend line on a chart without its removal from the Indicators collection.

Note

To learn more about the common indicator settings, examine the Indicators help document.

See Also