Skip to main content

RateOfChange Class

A Rate of Change indicator.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.2.dll

Declaration

public class RateOfChange :
    SeparatePaneIndicator

Remarks

The Chart Control uses the following formula to calculate the indicator’s values:

  • CurrentValue - A current point value at the given value level (the default value is Close).
  • Value - A point value at the given value level (the default value is Close).
  • n - The PointsCount property’s value. The default value is 14.

Example

This example shows how to create a Rate of Change indicator, configure its parameters, and display it in a separate pane.

private void Form1_Load(object sender, EventArgs e) {

    CandleStickSeriesView view = chartControl1.Series[0].View as CandleStickSeriesView;       

    RateOfChange rateOfChange = new RateOfChange {
        ValueLevel = ValueLevel.Close,
        CrosshairEnabled = DefaultBoolean.True,
        CrosshairLabelPattern = "{V:f3}",
        PointsCount = 14,
        LegendText = "Rate of Change (14)",
        ShowInLegend = true
    };
    view.Indicators.Add(rateOfChange);

    XYDiagramPane rocPane = new XYDiagramPane();
    rocPane.LayoutOptions.RowSpan = 2;
    xyDiagram.Panes.Add(rocPane);            
    rateOfChange.Pane = rocPane;

    SecondaryAxisY rocAxisY = new SecondaryAxisY();
    rocAxisY.WholeRange.AlwaysShowZeroLevel = false;
    rocAxisY.NumericScaleOptions.GridSpacing = 2;
    rocAxisY.Alignment = AxisAlignment.Far;
    rocAxisY.GridLines.Visible = true;
    xyDiagram.SecondaryAxesY.Add(rocAxisY);
    rateOfChange.AxisY = rocAxisY;     

    chartControl1.CrosshairOptions.ShowOnlyInFocusedPane = true;

    Legend rocLegend = new Legend { AlignmentHorizontal = LegendAlignmentHorizontal.Left };
    rocLegend.DockTarget = rocPane;
    rocLegend.AlignmentVertical = LegendAlignmentVertical.Top;
    chartControl1.Legends.Add(rocLegend);
    rateOfChange.Legend = rocLegend;
}

Implements

See Also