User login

  

William %R

Williams %R is a momentum indicator that is the inverse of the Fast Stochastic Oscillator. Also referred to as %R, Williams %R reflects the level of the close relative to the highest high for the look-back period. In contrast, the Stochastic Oscillator reflects the level of the close relative to the lowest low. %R corrects for the inversion by multiplying the raw value by -100. As a result, the Fast Stochastic Oscillator and Williams %R produce the exact same lines, only the scaling is different. Williams %R oscillates from 0 to -100. Readings from 0 to -20 are considered overbought. Readings from -80 to -100 are considered oversold. Unsurprisingly, signals derived from the Stochastic Oscillator are also applicable to Williams %R.

Interpretation

As with the Stochastic Oscillator, Williams %R reflects the level of the close relative to the high-low range over a given period of time. Assume that the highest high equals 110, the lowest low equals 100 and the close equals 108. The high-low range is 10 (110 - 100), which is the denominator in the %R formula. The highest high less the close equals 2 (110 - 108), which is the numerator. 2 divided by 10 equals .20. Multiply this number by -100 to get -20 for %R. Williams %R would equal -30 if the close was 103 (.30 x -100).

The centerline, -50, is an important level to watch. Williams %R moves between 0 and -100, which makes -50 the midpoint. Think of it as the 50 yard line in football. The offense has a higher chance of scoring when it crosses the 50 yard line. The defense has an edge as long as it prevents the offense from crossing the 50 yard line. A Williams %R cross above -50 signals that prices are trading in the upper half of their high-low range for the given look-back period. This suggests that the cup is half full. Conversely, a cross below -50 means prices are trading in the bottom half of the given look-back period. This suggests that the cup is half empty.

Low readings (below -80) indicate that price is near its low for the given time period. High readings (above -20) indicate that price is near its high for the given time period. The IBM example above shows three 14-day ranges (yellow areas) with the closing price at the end of the period (red dotted) line. Williams %R equals -9 when the close was at the top of the range. The Williams %R equals -87 when the close was near the bottom of the range. The close equals -43 when the close was in the middle of the range.

Overbought Oversold

As a bound oscillator, Williams %R makes it easy to identify overbought and oversold levels. The oscillator ranges from 0 to -100. No matter how fast a security advances or declines, Williams %R will always fluctuate within this range. Traditional settings use -20 as the overbought threshold and -80 as the oversold threshold. These levels can be adjusted to suit analytical needs and security characteristics. Readings above -20 for the 14-day Williams %R would indicate that the underlying security was trading near the top of its 14-day high-low range. Readings below -80 occur when a security is trading at the low end of its high-low range.

Momentum Failure

The failure to move back into overbought or oversold territory signals a change in momentum that can foreshadow a significant price move. The ability to consistently move above -20 is a show of strength. After all, it takes buying pressure to push %R into overbought territory. Once a security shows strength by pushing into overbought territory more than once, a subsequent failure to exceed this level shows weakening momentum that can foreshadow a decline.

Conclusions

Williams %R is a momentum oscillator that measures the level of the close relative to the high-low range over a given period of time. In addition to the signals mentioned above, chartists can use %R to gauge the six month trend for a security. 125-day %R covers around 6 months. Prices are above their 6-month average when %R is above -50, which is consistent with an uptrend. Readings below -50 are consistent with a downtrend. In this regard, %R can be used to help define the bigger trend (six months). Like all technical indicators, it is important to use the Williams %R in conjunction with other technical analysis tools. Volume, chart patterns and breakouts can be used to confirm or refute signals produced by Williams %R.

 

Display/hide source code
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using PTLRuntime.NETScript;
using System.Drawing;
 
namespace ind
{
        [FullRefresh]
    [KillExceptions]
        public class RLW : NETIndicator
    {
  
        public RLW()
            : base()
        {
                ProjectName = "%R Larry Williams";
                Comments = "Uses Stochastic to determine overbought and oversold levels";
            SetIndicatorLine("line1", Color.DodgerBlue, 1, LineStyle.SimpleChart);
            SeparateWindow = true;      
        }
 
        [InputParameter("ExtWPRPeriod", 0)]
        public int ExtWPRPeriod = 14;
        
        public IArray ExtWPRBuffer; 
                
                
                public override void Init()
                { 
                   string sShortName = "";
                //---- indicator buffer mapping
                   platform.SetIndexBuffer(0, ref ExtWPRBuffer);
                //---- indicator line
                   mql4.SetIndexStyle(0, mql4.DRAW_LINE);
                //---- name for DataWindow and indicator subwindow label
                   sShortName="%R(" + ExtWPRPeriod + ")";
                   platform.IndicatorShortName(sShortName);
                   mql4.SetIndexLabel(0, sShortName);
                //---- first values aren't drawn
                   platform.SetIndexDrawBegin(0, ExtWPRPeriod);
                }
        
        public override void OnQuote()
        {
                 int i = 0, nCountedBars = 0;  
                //---- insufficient data
                   if(mql4.Bars <= ExtWPRPeriod) 
                       return;
                //---- bars count that does not changed after last indicator launch.
                   nCountedBars = platform.IndicatorCounted();
                //----Williams’ Percent Range calculation
                   i = mql4.Bars - ExtWPRPeriod - 1;
                   if(nCountedBars > ExtWPRPeriod) 
                       i = mql4.Bars - nCountedBars - 1;  
                   while(i >= 0)
                     {
                       double dMaxHigh = mql4.High[mql4.Highest(mql4.NULL, 0, mql4.MODE_HIGH, ExtWPRPeriod, i)];
                       double dMinLow = mql4.Low[mql4.Lowest(mql4.NULL, 0, mql4.MODE_LOW, ExtWPRPeriod, i)];      
                       if(!CompareDouble((dMaxHigh - dMinLow), 0.0))
                           ExtWPRBuffer[i] = -100*(dMaxHigh - mql4.Close[i]) / (dMaxHigh - dMinLow);
                       i--;
                     }            
        }
        
        public bool CompareDouble(double Number1, double Number2)
                {
                   bool Compare = mql4.NormalizeDouble(Number1 - Number2, 8) == 0;
                   return(Compare);
                } 
        
    }    
}
 
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using PTLRuntime.NETScript;
using System.Drawing;
 
namespace ind
{
        [FullRefresh]
    [KillExceptions]
        public class RLW : NETIndicator
    {
  
        public RLW()
            : base()
        {
                ProjectName = "%R Larry Williams";
                Comments = "Uses Stochastic to determine overbought and oversold levels";
            SetIndicatorLine("line1", Color.DodgerBlue, 1, LineStyle.SimpleChart);
            SeparateWindow = true;      
        }
 
        [InputParameter("ExtWPRPeriod", 0)]
        public int ExtWPRPeriod = 14;
        
        public IArray ExtWPRBuffer; 
                
                
                public override void Init()
                { 
                   string sShortName = "";
                //---- indicator buffer mapping
                   platform.SetIndexBuffer(0, ref ExtWPRBuffer);
                //---- indicator line
                   mql4.SetIndexStyle(0, mql4.DRAW_LINE);
                //---- name for DataWindow and indicator subwindow label
                   sShortName="%R(" + ExtWPRPeriod + ")";
                   platform.IndicatorShortName(sShortName);
                   mql4.SetIndexLabel(0, sShortName);
                //---- first values aren't drawn
                   platform.SetIndexDrawBegin(0, ExtWPRPeriod);
                }
        
        public override void OnQuote()
        {
                 int i = 0, nCountedBars = 0;  
                //---- insufficient data
                   if(mql4.Bars <= ExtWPRPeriod) 
                       return;
                //---- bars count that does not changed after last indicator launch.
                   nCountedBars = platform.IndicatorCounted();
                //----Williams’ Percent Range calculation
                   i = mql4.Bars - ExtWPRPeriod - 1;
                   if(nCountedBars > ExtWPRPeriod) 
                       i = mql4.Bars - nCountedBars - 1;  
                   while(i >= 0)
                     {
                       double dMaxHigh = mql4.High[mql4.Highest(mql4.NULL, 0, mql4.MODE_HIGH, ExtWPRPeriod, i)];
                       double dMinLow = mql4.Low[mql4.Lowest(mql4.NULL, 0, mql4.MODE_LOW, ExtWPRPeriod, i)];      
                       if(!CompareDouble((dMaxHigh - dMinLow), 0.0))
                           ExtWPRBuffer[i] = -100*(dMaxHigh - mql4.Close[i]) / (dMaxHigh - dMinLow);
                       i--;
                     }            
        }
        
        public bool CompareDouble(double Number1, double Number2)
                {
                   bool Compare = mql4.NormalizeDouble(Number1 - Number2, 8) == 0;
                   return(Compare);
                } 
        
    }    
}
12345

Comments