First, a bit of a refresher. What is the awesome oscillator? Well, just to clarify, it is in fact actually called the “awesome oscillator” (points for originality), and it was developed by Bill M. Williams as a way to measure market momentum. This was a part of Williams’ more general market theory that applies psychology and chaos theory to the markets at large, and many of his techniques can be easily implemented in Rizm.
The oscillator is actually quite easy to calculate – it is the difference between the 34-period and 5-period simple moving averages of a given security. Similar to a SMA crossover strategy, it identifies buy signals where the short-term SMA rises above the long-term SMA, and vice versa. Although we don’t have a ready-made widget in Rizm, we can easily build it in the sandbox.
See below, which shows the daily bar chart of the S&P 500 with the Awesome Oscillator plotted directly underneath. Note how it follows the strength of a trend relatively well (and more importantly, note how it can be used to predict future trends).
Calculating the AO
The “textbook” Awesome Oscillator is calculated as follows:
SMA means simple moving average (an equally weighted average of the past “n” periods).
Aside from the AO value, our chart also denotes the color of the bar – which is equally as important as the value itself. If the current AO reading is greater than previous AO reading, it is displayed as green (and vice versa). This helps identify the optimal buy / sell signals in a strategy.
Although the AO is typically calculated with the High & Low average SMA, we will use the close SMA instead in Rizm. There is very little difference in practice, as long as we change the threshold values accordingly. Here’s how we will build the indicator in Rizm:
Ideally, we would like to buy when there is a bullish trend reversal, and sell when the trend comes to an end. But as we’ve seen before, this is a lot easier said than done. By looking at the chart below, we can try and create a method to identify bullish trend reversals.
It appears that buying at the “bottom” of the AO chart seems to be a good time to enter a long position, according to this chart. Taking this into account, here is an example of a strategy that can help enter and exit a position at this optimal time.
1. AO / AOSMA(34) < -0.005
2. AO increases in the past three days
(i.e. three green bars in the past three days)
3. AO decreases for four days before condition two is satisfied
(i.e. three red bars before it turns green)
Sell if all of these conditions are satisfied.
1. AO / AOSMA(34) > -0.005
2. AO decreases in the past three days
(i.e. three red bars in the past three days)
3. AO increases for four days before condition two is satisfied
(i.e. three green bars before it turns red)
For the buy signal, the first condition exists to ensure that we have a negative AO. We have set the critical value as -0.005 because we want to avoid false signals when the AO only falls by a small amount (which would result in a lot of unnecessary trading). Rather, this value is low enough to filter out these false signals, yet high enough to not miss out on a trend reversal. We also take the 34-period average to further smooth out any noise (note that the converse logic applies for the sell signal).
Below is a visual of the first condition, and directly underneath is the full algo built out in Rizm.
Backtesting the Strategy
We’ll backtest this strategy on a diversified basket of six stocks. We consider it well diversified because it gives us exposure to tech, finance, manufacturing, and retail. The basket consists of:
Our backtest from January 1, 2014 – October 17, 2014 gave us these results on a daily bar:
The most impressive aspect of these results is that our strategy can make impressive returns on a stock, even if a buy-and-hold would have lost money over the same period. For example, trading in Walmart yielded $540, which is more than if we had even done a short-and-hold (considering that the stock was in a downtrend in the first ten months of 2014). Our net profits are more than $4000, which is considerably higher than the $548 profit from a more vanilla buy-and-hold strategy.
The following two charts give some more detail on the backtest results – the first is the AO algo results, whereas the second one is for the buy-and-hold results.
Digging deeper into the backtest results shows that our algorithm has a near-perfect winning rate of 93% – which is pretty good for a strategy that was playing in an overall downtrending market for 3 of the stocks in the basket. The Sharpe ratio is equally impressive, as it is nearly four times higher than that of a buy-and-hold on this stock basket.