# Ultimate Oscillator Indicator Trading Strategy (Backtest)

Last Updated on October 22, 2022

Many momentum oscillators tend to turn very positive at the beginning of a major advance and quickly enter the overbought territory or even show bearish divergence while the market is still advancing. The ultimate oscillator attempts to correct that. Letâ€™s find out what this oscillator is made of.

**The ultimate oscillator (UO) is a momentum indicator designed to measure the price momentum of an asset across multiple timeframes. It uses three different periods (7, 14, and 28) to ascertain the momentum in the short, medium, and long-term market trends** **and then generates a weighted average of the three. Our backtests indicate that the indicator performs well over practically all settings, and you can make a very profitable mean reversion trading strategy out of it.**

## What is the ultimate oscillator?

The ultimate oscillator is a momentum indicator designed to measure the price momentum of an asset across multiple timeframes. It uses three different periods (7, 14, and 28) to ascertain the momentum in the short, medium, and long-term market trends and then generates a weighted average of the three.

The shortest timeframe has the most weight in the calculation, while the longest timeframe has the least weight. By using the weighted average of three different timeframes, the indicator is less volatility, which helps it to avoid the pitfalls in other oscillators that rely on a single timeframe â€” early overbought signals and bearish divergence during a strong price advance.

Many momentum oscillators tend to surge at the beginning of a strong advance, only to quickly become overbought or form a bearish divergence as the advance continues. The reason for this is that they are created for one timeframe. By incorporating longer timeframes into its calculation, the ultimate oscillator attempts to correct this fault. The oscillator is based on the notion that buying or selling “pressure” is determined by where a day’s closing price falls within the day’s true range.

## What is the formula for ultimate oscillator?

The calculation of the ultimate oscillator involves the following steps.

**Step 1: Calculating the Buying Pressure (BP)**

The buying pressure is the amount by which the current dayâ€™s close is above the “true low”, which is the lesser of the current day’s trading low and the previous dayâ€™s close. The formula is:

BP = Close â€” Minimum(Low or Prior Close).

**Step 2: Calculating the True Range (TR)**

The true range is the difference between the “true high” and the true low above. The true high is the greater of the current day’s high and the previous dayâ€™s close. The formula is:

TR = Maximum(High or Prior Close) â€” Minimum(Low or Prior Close)

**Step 3: Calculating the Averages for the various timeframes**

The default timeframes are 7, 14, and 28. The average for each of the timeframes is calculated as follows:

Average7 = (7-period BP Sum) / (7-period TR Sum)

Average14 = (14-period BP Sum) / (14-period TR Sum)

Average28 = (28-period BP Sum) / (28-period TR Sum)

**Step 4: Calculating the Ultimate Oscillator (UO)**

The resulting three averages are combined in proportions 4:2:1 and scaled to make a percentage, with the values ranging from 0 to 100. This is given as follows:

UO = 100 x [(4 x Average7) + (2 x Average14) + Average28] / (4+2+1)

Below we have provided you with a chart to show how it looks like in Amibroker:

The upper pane is the price chart of HYG (the ETF tracking junk bonds) and the lower pane shows the ultimate oscillator with the default settings. As you can see, the indicator oscillates up and down, hence the name. It might help you in pointing out great entry points and where to sell, something we backtest later in the article.

## Who invented the ultimate oscillator?

The ultimate oscillator was developed by Larry Williams in 1976, but it became popular after it was featured in Stocks & Commodities Magazine in 1985. The ultimate oscillator is just one of many Larry Williams strategies.

Larry Williams developed the concept as a way to account for the problems experienced in most oscillators when used over different lengths of time.

## What does the ultimate oscillator tell you?

The indicator uses three different periods (7, 14, and 28) to ascertain the momentum in the short, medium, and long-term market trends. But it combines them by weighting them to get a more reliable momentum of the price than what you get from other oscillators that are based on one time frame.

As with most oscillators, the ultimate oscillator moves between 0 and 100, and just like the RSI, levels below 30 are considered oversold, and levels above 70 are considered overbought.

Trading signals are only generated when there is a divergence between the price and the indicator, but three criteria must be met. For example, for the indicator to generate a buy signal, these conditions must be met:

- A bullish divergence must form, which means that the price makes a lower low but the indicator is at a higher low.
- The first low in the divergence (the lower one) must have been below 30 â€” that is, the divergence started from oversold territory and is more likely to result in an upside price reversal.
- The ultimate oscillator must rise above the divergence high â€” the high point between the two lows of the divergence.

The opposite is required to generate a sell signal.

Let’s go on to backtest some trading strategies based on the indicator:

## Ultimate oscillator trading strategy

Let’s first backtest using the default parameters of the indicator: 7, 14, and 28. We buy when it crosses below 40 and we sell when it crosses above 50. The equity curve looks like this when we backtest on SPY (the ETF tracking S&P 500):

As you can see, the result has a lot to be desired! This is pretty far from any tradeable trading strategy.

### Ultimate oscillator trading strategy using backtest optimization

Let’s do a backtest to make a potential **optimized** ultimate oscillator trading strategy.

We like to start backtesting by using a strategy optimization. Why do we use an optimization? We do that because it’s a great way to find out where the best settings are or if we are likely to curve fit the strategy.

The ultimate oscillator has many settings thus making any optimizations liable to many simulations. To limit the simulations we only optimize the three settings and not the buy and sell thresholds. These are our settings:

- The first setting has a minimum value of 2 – a max of 10 (interval of 2)
- The first setting has a minimum value of 6 – a max of 14 (interval of 2)
- The first setting has a minimum value of 10 – a max of 20 (interval of 2)
- The buy threshold is set to 30 for all simulations
- We sell when the close is above yesterday’s high

This is many simulations and below we have an excerpt ranked on profit factor:

The first, second, and third column show the different settings we put into the indicator. The rows show the different trading performance metrics for each setting.

The table above contains about 33% of the optimizations. The result is pretty impressive: Only one backtest/simulation has a profit factor below 2! Of all the hundreds of indicators we have backtested, this is absolutely one of the best we have seen.

For example, here is one backtest with a profit factor of 2.5:

There are 355 trades, the average gain is 0.77% per trade, the win rate is 78%, and max drawdown is 25%.

The annual returns are like this:

There are only two down years while it has frequent spectacular years.

## Ultimate oscillator strategy – ending remarks

There are plenty of oscillating trading indicators and the ultimate oscillator has proved pretty consistent and stable in our backtests. It’s a mean reversion indicator but it has proved to be solid and consistent over many different settings.

We didn’t include the ultimate oscillator in our article about the best indicator for swing trading, but it certainly would have qualified as one of the best. Thus, you can potentially build an **ultimate oscillator trading strategy**.