Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat> Co-authored-by: Warp <agent@warp.dev>
3.4 KiB
AO: Awesome Oscillator
"Awesome" is a marketing term. The math is just a moving average crossover. But sometimes, simple is all you need.
The Awesome Oscillator (AO) is a momentum indicator that strips away the noise of closing prices to reveal the market's immediate velocity compared to its broader trend. It quantifies the gap between short-term and long-term market consensus using median prices, effectively serving as a non-lagging confirmation of trend direction.
Historical Context
Bill Williams introduced the AO in Trading Chaos (1995). He argued that standard indicators fixated on closing prices missed the volatility that happens during the bar. By focusing on the median price, AO attempts to reflect the market's "balance point" rather than just its finish line.
It is a core component of the Williams Trading System, often used in conjunction with the Alligator indicator to confirm trend entries.
Architecture & Physics
The AO is architecturally simple: it is the difference between two Simple Moving Averages (SMA) of the Median Price.
- Median Price: The midpoint of the trading range is calculated:
(High + Low) / 2. - Smoothing: These midpoints are smoothed over two distinct timeframes (Fast and Slow).
- Differential: The slow average is subtracted from the fast average.
Why Median Price?
Using (High + Low) / 2 instead of Close is a deliberate architectural choice. It filters out the noise of the "last second" trades that determine the close, focusing instead on the center of gravity for the entire period. This makes AO less susceptible to manipulation or anomalies at the bell.
Mathematical Foundation
The math is elegant in its simplicity.
\text{Median Price}_t = \frac{H_t + L_t}{2}
AO_t = SMA(\text{Median Price}, n_{fast}) - SMA(\text{Median Price}, n_{slow})
Where:
n_{fast}is the fast period (default 5).n_{slow}is the slow period (default 34).
Performance Profile
The AO is lightweight and suitable for high-frequency applications.
Zero-Allocation Design
The implementation uses stackalloc for internal buffers when processing spans, ensuring no heap allocations occur during the calculation. The hot path for streaming updates is purely scalar and allocation-free.
| Metric | Score | Notes |
|---|---|---|
| Throughput | 2ns | 2ns / bar (Apple M1 Max). |
| Allocations | 0 | Hot path is allocation-free. |
| Complexity | O(1) | Constant time updates. |
| Accuracy | 10/10 | Matches standard implementations. |
| Timeliness | 6/10 | Lags due to SMA smoothing. |
| Overshoot | 8/10 | Can overshoot in volatile markets. |
| Smoothness | 6/10 | Smoother than raw price, but reactive. |
Validation
Validation is performed against industry-standard libraries.
| Library | Status | Notes |
|---|---|---|
| QuanTAlib | ✅ | Validated. |
| Skender | ✅ | Matches GetAwesome. |
| Tulip | ✅ | Matches ti.ao. |
| Ooples | ✅ | Matches CalculateAwesomeOscillator. |
| TA-Lib | N/A | Not implemented in TA-Lib. |
Common Pitfalls
- The "Awesome" Misnomer: Do not let the name fool you. It is a lagging indicator (it uses SMAs). It confirms trends; it does not predict them.
- Twin Peaks: The "Twin Peaks" signal is often cited but rarely backtested successfully in isolation. It requires trend confirmation (e.g., via the Alligator).