Bill Williams Awesome Oscillator Trading Strategy
The Bill Williams Awesome Oscillator trading strategy is a quantitative trading strategy developed based on the recommendations proposed by Bill Williams in his book "New Trading Dimensions". The strategy uses the…

Overview
The Bill Williams Awesome Oscillator trading strategy is a quantitative trading strategy developed based on the recommendations proposed by Bill Williams in his book "New Trading Dimensions". The strategy uses the difference between fast and slow moving averages to construct an oscillator indicator and displays it as a histogram, generating trading signals through color changes of the histogram.
Strategy Logic
The core indicator of this strategy is the Awesome Oscillator (AO). Its formula is:
AO = SMA(Median Price, Fast Length) - SMA(Median Price, Slow Length)
Where Median Price takes the average of high and low prices; Fast Length represents the period of the fast moving average; Slow Length represents the period of the slow moving average.
The AO indicator reflects the oscillation of market prices at different time scales through the difference between fast and slow moving averages. When the fast moving average is higher than the slow one, it signals that short-term price momentum is stronger than long-term momentum and gives a buy signal. When the fast moving average is lower than the slow one, it signals that short-term price momentum is weaker than long-term momentum and gives a sell signal.
The strategy uses the difference between the current AO value and its previous period to determine the current period's long/short stance. Different colors are used to identify them on the histogram: blue when current AO is greater than previous period, indicating suitable for long; red when current AO is less than previous period, indicating suitable for short.
Advantage Analysis
The main advantages of this strategy include:
- Using the difference between moving averages to construct the indicator smooths price data and helps filter market noise;
- The difference between fast and slow moving averages captures price trend changes across different time horizons;
- The histogram visually presents long/short status for ease of judging trading direction;
- Customizable parameters to adjust indicator sensitivity catering to different trading instruments.
Risk Analysis
There are also some risks with this strategy:
- Improper parameter settings may result in frequent trading signals, leading to overtrading;
- The relatively complex construction of the AO indicator may lead to missing trading opportunities if parameters are not properly set;
- Signals come from a single source lacking verification from other indicators.
To mitigate the above risks, parameters can be optimized, indicator construction can be adjusted, and other indicators can be used for verification.
Optimization Directions
Some directions this strategy can be optimized on include:
- Optimize fast and slow moving average lengths to find the best parameter combination;
- Try different types of moving averages to construct the AO indicator, e.g. EMA, LWMA, etc;
- Incorporate trend-following and oscillating indicators to improve the AO;
- Add stop loss mechanisms to control losses per trade.
Conclusion
In conclusion, the Bill Williams Awesome Oscillator trading strategy effectively identifies short-term reversal opportunities by judging price trend changes using the difference between fast and slow moving averages. This strategy has a clear concept and is easy to implement. With parameter optimization and incorporation of other indicators, it has the potential to achieve good trading performance.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 34 | Length Slow |
| v_input_2 | 5 | Length Fast |
| v_input_3 | false | Trade reverse |
Source Pine Script
/*backtest
start: 2022-12-12 00:00:00
end: 2023-12-18 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 29/12/2016
// This indicator is based on Bill Williams` recommendations from his book
// "New Trading Dimensions". We recommend this book to you as most useful reading.
// The wisdom, technical expertise, and skillful teaching style of Williams make
// it a truly revolutionary-level source. A must-have new book for stock and
// commodity traders.
// The 1st 2 chapters are somewhat of ramble where the author describes the
// "metaphysics" of trading. Still some good ideas are offered. The book references
// chaos theory, and leaves it up to the reader to believe whether "supercomputers"
// were used in formulating the various trading methods (the author wants to come across
// as an applied mathemetician, but he sure looks like a stock trader). There isn't any
// obvious connection with Chaos Theory - despite of the weak link between the title and
// content, the trading methodologies do work. Most readers think the author's systems to
// be a perfect filter and trigger for a short term trading system. He states a goal of
// 10%/month, but when these filters & axioms are correctly combined with a good momentum
// system, much more is a probable result.
// There's better written & more informative books out there for less money, but this author
// does have the "Holy Grail" of stock trading. A set of filters, axioms, and methods which are
// the "missing link" for any trading system which is based upon conventional indicators.
// This indicator plots the oscillator as a histogram where periods fit for buying are marked
// as blue, and periods fit for selling as red. If the current value of AC (Awesome Oscillator)
// is over the previous, the period is deemed fit for buying and the indicator is marked blue.
// If the AC values is not over the previous, the period is deemed fir for selling and the indicator
// is marked red.
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy("Bill Williams. Awesome Oscillator (AO)")
nLengthSlow = input(34, minval=1, title="Length Slow")
nLengthFast = input(5, minval=1, title="Length Fast")
reverse = input(false, title="Trade reverse")
xSMA1_hl2 = sma(hl2, nLengthFast)
xSMA2_hl2 = sma(hl2, nLengthSlow)
xSMA1_SMA2 = xSMA1_hl2 - xSMA2_hl2
cClr = xSMA1_SMA2 > xSMA1_SMA2[1] ? blue : red
pos = iff(xSMA1_SMA2 > xSMA1_SMA2[1], 1,
iff(xSMA1_SMA2 < xSMA1_SMA2[1], -1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(xSMA1_SMA2, style=histogram, linewidth=1, color=cClr)Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-19. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Bill-Williams-Awesome-Oscillator-Trading-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- ADX Momentum Trend StrategyPine Script · Momentum · 10m
- Adaptive Trend Following Strategy Based on Momentum OscillatorPine Script · Momentum · 1d
- Bollinger Bands Momentum Trend Following Quantitative StrategyPine Script · Momentum · 1d
- Confirmed SMA Crossover Momentum StrategyPine Script · Momentum · 1d
- Cross Momentum Trend Following Strategy SMA RSI Cross Momentum SystemPine Script · Momentum · 1h
- Dual Moving Average Momentum Trading Strategy Time Optimized Trend Following SystemPine Script · Momentum · 2m