control.Region(n).AnySeries([n]).CalcTrend(ByRef nStartValue, ByRef nEndValue, ByRef nXStart, ByRef nYStart, ByRef nXEnd, ByRef nYEnd, sHighLowIndex)

PurposeCalculates the trend of the series and retrieves all necessary informations for marking the trend.
Parameter
nStartValue Double

A variable, which contains upon successful call the calculated start value of the trend.

nEndValue Double

A variable, which contains upon successful call the calculated end value of the trend.

nXStart Long

A variable, which contains upon successful call the necessary left X position for a line within the grid, i.e. the left border of the grid.

nYStart Long

A variable, which contains upon successful call the Y pixel position which would correspond to the value of nStartValue.

nXEnd Long

A variable, which contains upon successful call the necessary right X position for a line within the grid, i.e. the right border of the grid.

nYEnd Long

A variable, which contains upon successful call the Y pixel position which would correspond to the value of nEndValue.

sHighLowIndex String

Defines in case of a HighLow series, which values should be calculated: Open, High, Low or Close (=default).

Return valueIf successful 0, in case of an error, an element of the RMCError enumeration.
Remarks

Trend calculation is done using the "Linear Least Square Fit" method. After successfull call you get, besides the start and end values of the trend channel, all necessary informations you need to add a custom Line object to your chart for marking the trend.

NOTE: This method is only available with BarSeries, LineSeries, HighLowSeries and VolumeBarSeries.

Example ' Calculate the trend of the series:
RMChartX1.Region(1).BarSeries(1).CalcTrend nStartValue, nEndValue, nXStart, nYStart, nXEnd, nYEnd
' Add a custom line object to mark the trend:
RMChartX1.AddCustomObjectline
RMChartX1.CustomObjectline(1).SetProperties nXStart, nYStart, nXEnd, nYEnd, RMC_DASH_LINE, Red