A momentum histogram that compares a short-term and a longer-term average of price.
The Awesome Oscillator (AO) is a momentum indicator developed by Bill Williams. It gauges market momentum by comparing a recent average of price against a longer-term average. Both averages are calculated from the "median price" of each bar (the high plus the low, divided by two), rather than the close. AO is drawn as a histogram that oscillates above and below a zero line, with bars typically colored green or red depending on whether each value is higher or lower than the one before it. It ships as a built-in indicator on most charting platforms; on TradingView it can also be reproduced in Pine Script using the ta.sma() function on hl2.
For each bar, AO first finds the median price, which is simply the high plus the low divided by two (the built-in hl2 in Pine Script). It then takes a 5-period simple moving average of that median price and subtracts a 34-period simple moving average of the same median price. The result is plotted as a histogram around zero. When the fast (5-period) average is above the slow (34-period) average, AO is positive and bars sit above the zero line; when the fast average is below the slow one, AO is negative and bars sit below zero. The 5/34 lengths are the defaults Bill Williams specified and are what most platforms use out of the box.
Default lengths are 5 (fast) and 34 (slow), both applied to the median price (high+low)/2, as Bill Williams defined. These are the standard settings on most platforms; some traders experiment with other lengths, but the 5/34 pair is the conventional baseline.
//@version=6
indicator("Awesome Oscillator", shorttitle="AO")
medianPrice = hl2
ao = ta.sma(medianPrice, 5) - ta.sma(medianPrice, 34)
// green when current value is at or above the prior bar, red when below
aoColor = ao >= ao[1] ? color.green : color.red
plot(ao, title="AO", style=plot.style_histogram, color=aoColor)
hline(0, title="Zero", color=color.gray)Pro tip: AO is most often used as a context tool rather than in isolation. Traders commonly look at the zero-line position, bar color changes, and the overall trend together, and compare what AO shows against price structure on the chart instead of reacting to any single AO event. This is educational context, not a recommendation to trade.
Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.