control.Region(n).AnySeries([n]).CalcAverage(ByRef nAverage, ByRef nXStart, ByRef nYStart, ByRef nXEnd, ByRef nYEnd, sHighLowIndex)

PurposeCalculates the numeric average of the series and retrieves all necessary informations for marking the average.
Parameter
nAverage Double

A variable, which contains upon successful call the numeric average of the series' data.

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 necessary Y position for a line within the grid, i.e. the pixel position, which would correspond to the value of nAverage.

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

Same as argument nYStart

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

Calculating the numeric average of a data series is not a big deal, you could of course do it yourself, but with this method you get, besides the average value, all necessary informations you need, to add a custom Line object to your chart for marking the average.

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

Example ' Calculate the average of the series:
RMChartX1.Region(1).BarSeries(1).CalcAverage nAverage, nXStart, nYStart, nXEnd, nYEnd
' Add a custom line object to mark the average:
RMChartX1.AddCustomObjectline
RMChartX1.CustomObjectline(1).SetProperties nXStart, nYStart, nXEnd, nYEnd, RMC_DASH_LINE, Green