ComponentOne FinancialChart for WinForms
Analytics / Indicators / Relative Strength Index
In This Topic
    Relative Strength Index
    In This Topic

    Relative Strength Index (RSI) indicator for FinancialChart is a momentum oscillator, which measures velocity and magnitude of price movements. It compares the upward movements in closing price of an asset to the downward movements over a trading period, and intends to determine strength or weakness of a stock. It fluctuates between 0 and 100. The stocks with strong positive changes have a higher RSI than the stocks with strong negative changes.

    It finds application in comparing the magnitude of recent gains to recent losses, to determine the overbought and oversold conditions of an asset. Stocks are considered overbought when RSI is above 70, and oversold when below 30.

    FinancialChart also enables you to fetch the calculated RSI values at run-time using GetValues() method. This can help in creating alerts in application or maintaining logs while working with dynamic data.

    Notice that the given code snippet uses a class DataService. To see the code, refer to Average True Range. In addition, the sample creates an instance of the RSI class to work with Relative Strength Index.

    Dim rsi As New RSI() With
    {
        .Name = "RSI"
    }
    
    Dim dataService__1 = DataService.GetService()
    Dim data = dataService__1.GetSymbolData("box")
    
    FinancialChart1.BeginUpdate()
    FinancialChart1.BindingX = "date"
    FinancialChart1.Binding = "close"
    FinancialChart1.Series.Add(New FinancialSeries())
    FinancialChart1.ChartType = C1.Chart.Finance.FinancialChartType.Line
    FinancialChart1.DataSource = data
    FinancialChart1.Rendered += Function(s, a)
                                    financialChart2.AxisX.Min = FinancialChart1.AxisX.ActualMin
                                    financialChart2.AxisX.Max = FinancialChart1.AxisX.ActualMax
    
                                End Function
    FinancialChart1.EndUpdate()
    
    financialChart2.BeginUpdate()
    financialChart2.ChartType = C1.Chart.Finance.FinancialChartType.Line
    financialChart2.BindingX = "date"
    financialChart2.Binding = "high,low,close"
    financialChart2.Series.Add(rsi)
    financialChart2.Legend.Position = C1.Chart.Position.Bottom
    financialChart2.DataSource = data
    financialChart2.EndUpdate()
    period.Value = rsi.Period
    
    RSI rsi = new RSI() { Name = "RSI" };
    
    var dataService = DataService.GetService();
    var data = dataService.GetSymbolData("box");
    
    financialChart1.BeginUpdate();
    financialChart1.BindingX = "date";
    financialChart1.Binding = "close";
    financialChart1.Series.Add(new FinancialSeries());
    financialChart1.ChartType = C1.Chart.Finance.FinancialChartType.Line;
    financialChart1.DataSource = data;
    financialChart1.Rendered += (s, a) =>
    {
        financialChart2.AxisX.Min = financialChart1.AxisX.ActualMin;
        financialChart2.AxisX.Max = financialChart1.AxisX.ActualMax;
    };
    financialChart1.EndUpdate();
    
    financialChart2.BeginUpdate();
    financialChart2.ChartType = C1.Chart.Finance.FinancialChartType.Line;
    financialChart2.BindingX = "date";
    financialChart2.Binding = "high,low,close";
    financialChart2.Series.Add(rsi);
    financialChart2.Legend.Position = C1.Chart.Position.Bottom;
    financialChart2.DataSource = data;
    financialChart2.EndUpdate();
    period.Value = rsi.Period;