Larry Williams developed the Ultimate Oscillator, which was first published in 1985. The Ultimate Oscillator is calculated by means of taking the weighted sum of three oscillators in different timeframes. These three timeframes are the short-term, middle and long-term market cycles. The typical period lengths used are 7, 14 and 28, and the value of the indicator moves between 0 and 100. Values above 70 signify an overbought situation, and values below 30 show that it is oversold.
Williams defined the following criteria for a buy signal:
A bullish divergence between price and oscillator can be observed, meaning that the market makes a new low but the oscillator remains unchanged.
While this divergence is forming, the oscillator falls below 30.
The oscillator will then resume its upward move towards the high at which it peaked before the divergence began forming.
The buy signal is created when the price breaches that last high.
The long position is closed if the oscillator rises above 70 or if the oscillator rises above 50 and then falls back below 45. A sell signal consists of bearish divergences forming above 70. These positions are closed once the 30 level marker is breached.
UltimateOscillator(int fast, int intermediate, int slow)
UltimateOscillator(IDataSeries inSeries, int fast, int intermediate, int slow)
UltimateOscillator(int fast, int intermediate, int slow)[int barsAgo]
UltimateOscillator(IDataSeries inSeries, int fast, int intermediate, int slow)[int barsAgo]
When using this method with an index (e.g. UltimateOscillator (5)[int barsAgo] ), the value of the indicator will be issued for the referenced bar.
// Output of the values for the UltimateOscillator with settings of 7,14,28
Print("The current value for the Ultimate Oscillator is " + UltimateOscillator(7, 14, 28));