AwesomeOscillator — Awesome Oscillator
תוכן זה אינו זמין עדיין בשפה שלך.
Bill Williams’ momentum gauge: a fast simple average of the bar midpoint minus a slow one. Positive and rising reads as bullish momentum; the classic signals (twin peaks, saucer) are all patterns in its histogram.
Signature
AwesomeOscillator(fast, slow, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
fast |
int Param or literal | Yes | Fast SMA of the midpoint. Convention 5. Bounds 1–100. |
slow |
int Param or literal | Yes | Slow SMA of the midpoint. Convention 34. Bounds 2–200. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads high and low. |
Formula
$$ \text{AO} = \text{SMA}\left(\tfrac{H+L}{2}, fast\right) - \text{SMA}\left(\tfrac{H+L}{2}, slow\right) $$
Warmup
slow bars; 0 until both windows are full.
Reading the value
ao.valueao > 0ao.crossed_above(0)Example
class AoZeroCross(Strategy): """Long on a zero-line cross of the Awesome Oscillator.""" trade = Symbol() sizing = FixedCapital()
def execute(self): ao = AwesomeOscillator(5, 34, on=self.trade) if ao.crossed_above(0) and self.trade.is_flat: self.buy(self.trade, reason="AO zero cross up") if ao.crossed_below(0) and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="AO zero cross down")Notes
- Bill Williams; periods are conventionally fixed at 5/34 — exposed as Params anyway, with
bounds kept tight because the platform pre-allocates buffers to
max. - Proven by an assert-via-trade run on SPY daily (matched a strategy-side midpoint-SMA reference on every bar; zero alarm trades).
AcceleratorOscillator(Tier 2) is AO minus its own 5-bar SMA.