ComponentOne FinancialChart for WinForms
Analytics / Indicators / Williams %R
In This Topic
    Williams %R
    In This Topic

    Williams %R indicator for the FinancialChart is a momentum indicator, which compares the current asset price to the highest price over the look back period. Its look-back is typically 14 periods. The indicator fluctuates between 0 and -100. It is the inverse of a fast Stochastic Oscillator. While the Williams %R displays the level of a stock's close relative to the highest high for the look-back period, the Stochastic Oscillator shows the level of a stock's close relative to the lowest low. Both the indicators show same lines, however scaling is different. It finds application in determining Overbought/Oversold levels, providing buy and sell signals, and momentum confirmations.

    To work with WilliamsR indicator, you need to create an instance of WilliamsR class. FinancialChart also enables you to fetch the calculated WilliamsR values at run-time using GetValues() method. This can help in creating alerts in application or maintaining logs while working with dynamic data.

    The following code snippet creates an instance of the WilliamsR class to use the indicator.

    Dim wr As New WilliamsR() With
    {
        .Name = "WilliamsR"
    }
    
    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(wr)
    financialChart2.Legend.Position = C1.Chart.Position.Bottom
    financialChart2.DataSource = data
    financialChart2.EndUpdate()
    period.Value = wr.Period
    
    WilliamsR wr = new WilliamsR() { Name = "WilliamsR" };
    
    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(wr);
    financialChart2.Legend.Position = C1.Chart.Position.Bottom;
    financialChart2.DataSource = data;
    financialChart2.EndUpdate();
    period.Value = wr.Period;