Awesome Oscillator (AO)
I. What is the Awesome Oscillator
The Awesome Oscillator (AO) is an oscillator used to measure market momentum. It evaluates the current market driving force by comparing the difference between short-period and long-period Simple Moving Averages (SMA) of the Median Price, displayed as a histogram that visually reflects the direction and changes in momentum.
Historical Background
AO was invented by legendary trader Bill Williams, first published in his books Trading Chaos and New Trading Dimensions. Bill Williams was a pioneer in applying chaos theory to financial trading and developed a complete trading system based on chaos theory, with AO being one of its core components. Williams’ trading philosophy emphasizes that markets are fundamentally non-linear, and AO attempts to capture the essential changes in market momentum.
Indicator Classification
- Type: Oscillator, displayed as a histogram in a separate panel
- Category: Momentum
- Default Parameters: Short period , Long period
- Value Range: Unbounded, oscillates around the zero line
Bill Williams believed that the Median Price represents the “fair price” of a bar better than the closing price, as it reflects the midpoint of the bull-bear battle during that period and is not affected by the randomness of the last trade at the close.
II. Mathematical Principles and Calculation
Core Formulas
Step 1: Calculate Median Price
Step 2: Calculate short-period and long-period SMAs
Step 3: Calculate AO
Histogram Coloring Rules
- When — bar is green (momentum increasing)
- When — bar is red (momentum decreasing)
Step-by-Step Calculation Logic
- Calculate the Median Price for each bar: (High + Low) / 2
- Calculate 5-period SMA: Simple moving average of the Median Price over 5 periods
- Calculate 34-period SMA: Simple moving average of the Median Price over 34 periods
- Subtract: AO = Short SMA - Long SMA
- Color: Compare current AO with the previous period’s AO
AO and MACD share a similar concept (both are short-term average minus long-term average), but differ in two key ways:
- AO uses SMA; MACD uses EMA
- AO uses Median Price as input; MACD uses Close price as input This makes AO’s response smoother but more stable.
III. Python Implementation
import numpy as np
import pandas as pd
def awesome_oscillator(high: pd.Series,
low: pd.Series,
short_period: int = 5,
long_period: int = 34) -> pd.DataFrame:
"""
Calculate the Awesome Oscillator (AO)
Parameters
----------
high : pd.Series
High price series
low : pd.Series
Low price series
short_period : int
Short SMA period, default 5
long_period : int
Long SMA period, default 34
Returns
-------
pd.DataFrame
DataFrame with AO values and histogram color
"""
median_price = (high + low) / 2
sma_short = median_price.rolling(window=short_period, min_periods=short_period).mean()
sma_long = median_price.rolling(window=long_period, min_periods=long_period).mean()
ao = sma_short - sma_long
# Histogram color
color = np.where(ao > ao.shift(1), "green", "red")
return pd.DataFrame({
"AO": ao,
"Color": color
}, index=high.index)
# ========== Usage Example ==========
if __name__ == "__main__":
np.random.seed(42)
dates = pd.date_range("2024-01-01", periods=120, freq="D")
base = 100 + np.cumsum(np.random.randn(120) * 1.0)
df = pd.DataFrame({
"date": dates,
"open": base + np.random.randn(120) * 0.3,
"high": base + np.abs(np.random.randn(120) * 0.8),
"low": base - np.abs(np.random.randn(120) * 0.8),
"close": base,
"volume": np.random.randint(1000, 10000, size=120),
})
df.set_index("date", inplace=True)
# Calculate AO
ao_df = awesome_oscillator(df["high"], df["low"])
df = pd.concat([df, ao_df], axis=1)
print("=== Awesome Oscillator Results (last 15 rows) ===")
print(df[["close", "AO", "Color"]].tail(15).to_string())
# Zero line crossover signals
df["cross"] = np.where(
(df["AO"] > 0) & (df["AO"].shift(1) <= 0), "bullish_cross",
np.where(
(df["AO"] < 0) & (df["AO"].shift(1) >= 0), "bearish_cross", ""
)
)
crosses = df[df["cross"] != ""]
print("\n=== Zero Line Crossover Signals ===")
print(crosses[["close", "AO", "cross"]].to_string())
# Saucer signal detection (simplified)
df["saucer_buy"] = (
(df["AO"] > 0) &
(df["AO"].shift(1) < df["AO"].shift(2)) &
(df["AO"] > df["AO"].shift(1))
)
saucer = df[df["saucer_buy"]]
print("\n=== Saucer Buy Signals (V-shaped reversal in AO > 0 zone) ===")
print(saucer[["close", "AO"]].head(10).to_string())
IV. Problems the Indicator Solves
1. Zero Line Crossover
The most basic signal:
- AO crosses above zero — Short-term momentum exceeds long-term momentum, buy signal
- AO crosses below zero — Short-term momentum weaker than long-term momentum, sell signal
2. Saucer Signal
Bill Williams’ most favored AO signal:
Saucer Buy (above zero line):
- AO is above the zero line
- A red bar appears (AO declines)
- A green bar follows (AO recovers) — Buy
Saucer Sell (below zero line):
- AO is below the zero line
- A green bar appears (AO rises)
- A red bar follows (AO declines) — Sell
3. Twin Peaks Signal
Twin Peaks Buy:
- AO forms two troughs below the zero line
- The second trough is higher than the first (less negative)
- Green bars appear between the two troughs
- Buy when a green bar appears after the second trough
Twin Peaks Sell:
- AO forms two peaks above the zero line
- The second peak is lower than the first
- Red bars appear between the two peaks
- Sell when a red bar appears after the second peak
4. Momentum Direction Assessment
Histogram color changes visually reflect momentum direction:
- Consecutive green bars — upward momentum continues to strengthen
- Consecutive red bars — downward momentum continues to strengthen
Bill Williams’ trading system requires AO to be used in conjunction with other Williams indicators (such as Alligator and Fractal). Using AO signals alone can generate many false signals in ranging markets.
V. Advantages, Disadvantages, and Use Cases
Advantages
| Advantage | Description |
|---|---|
| Visually intuitive | Color-coded histogram makes momentum changes instantly visible |
| Complete signal system | Zero line crossover + Saucer + Twin Peaks complement each other |
| Uses Median Price | More robust than close price, reduces closing noise |
| Simple calculation | Difference of two SMAs, easy to implement |
Disadvantages
| Disadvantage | Description |
|---|---|
| SMA lag | Uses SMA rather than EMA, slower response than MACD |
| Many false signals in ranging markets | Zero line crossovers are frequent and unreliable without trends |
| Signal subjectivity | Identifying Saucer and Twin Peaks patterns involves some subjectivity |
| No overbought/oversold bounds | Cannot clearly define extreme zones like RSI |
Use Cases
- Trending markets: AO produces high-quality signals in markets with clear trends
- Combined with Williams system: Works best with Alligator and Fractal indicators
- Medium to long-term trading: The 34-period long SMA makes AO better suited for medium to long-term use
Comparison with Related Indicators
| Comparison | AO | MACD | Momentum |
|---|---|---|---|
| Moving Average Type | SMA | EMA | None |
| Data Source | Median Price | Close Price | Close Price |
| Signal Line | None | Yes (9 EMA) | None |
| Histogram | AO itself | MACD - Signal | None |
| Suited Style | Medium to long | Medium | Short-term |
- Use Alligator for direction first: Focus on AO signals only when the Alligator indicator is open (three lines diverging).
- Saucer signals are most reliable: Within a confirmed trend, the Saucer signal has a far higher win rate than zero line crossovers.
- Twin Peaks require patience: Twin Peaks signals take time to form, but once triggered, they usually indicate a significant move.
- Watch histogram color changes: After 5 or more consecutive same-color bars, a color change is often an early signal of a momentum shift.