Awesome Oscillator
Awesome Oscillator, Bill Williams' — a 5-period minus a 34-period simple average of the median price, drawn as a histogram around zero.
It measures the gap between a short and a medium horizon of the same series. Readings: the side of zero, and the bar colour, which encodes only whether this bar's value is above or below the previous one.
01The study, live
Computed by Bentrix’s own code over the same synthetic bars on every page — an illustration of how the study behaves, not a market.
What this figure shows
The figure is computed over 300 sample bars. Awesome Oscillator has no value on the first 33 — the bars it needs before it can answer — and its first value stands on bar 34. Its bars run between -0.0051 and 0.0057 on these bars, and the last value is 0.0012. Counting the conditions the study declares on these bars: crosses above 0 once; crosses below 0 once; the histogram turns up 24 times; the histogram turns down 25 times. Press a condition under the figure to see each place marked. As states rather than moments: is above 0 on 138 bars; is below 0 on 129 bars.
02Its parts, named
03What you see
A histogram around zero: a 5-bar SMA of the median price minus a 34-bar one, coloured by whether it rose or fell from the previous bar.
04Where it comes from
Bill Williams introduced the Awesome Oscillator in New Trading Dimensions (1998) as his measure of momentum: the gap between a 5-bar and a 34-bar simple average of the bars' median price.
05The formula
AO = SMA((H+L)/2, 5) − SMA((H+L)/2, 34)
06A worked example
The sample bars used here are eight: closes 20, 21, 23, 22, 24, 25, 24, 26; highs 21, 22, 24, 24, 25, 26, 26, 27; lows 18, 19, 20, 21, 21, 23, 23, 23; opens 19, 20, 21, 23, 22, 24, 25, 24; volumes 100, 120, 150, 90, 140, 160, 80, 170.
The median prices, (high + low) / 2, are 19.5, 20.5, 22.0, 22.5, 23.0, 24.5, 24.5, 25.0. Take a fast window of 3 and a slow one of 6 in place of 5 and 34.
The average of the last three medians is 24.67; of the last six, 23.58.
AO = 24.67 − 23.58 = 1.08
The bar is drawn in the rising colour if this value is higher than the previous bar's and in the falling colour if lower — the colour is the direction of the oscillator, not its sign.
07Built in Assay
The same study written in Assay, Bentrix’s script language, and drawn by Bentrix itself as the script’s graph: each block is one step of the formula. On the ladder the steps stand in the script’s order, one a row; on the board each wire carries a value from the block that gives it to the block that reads it, left to right. The script computes exactly what the study computes — Bentrix checks the two against each other, candle by candle.
//@version=6 indicator("Awesome Oscillator") // The short average of the bar's middle price, less the long one. ao = ta.sma(hl2, 5) - ta.sma(hl2, 34) plot(ao, "AO", style = plot.style_histogram)
Paste it into the Assay IDE to put it on a chart, or to change it. Looking at the graph is free in every package; editing it as blocks is Plus.
08Readings — what traders look for
Williams named patterns of its bars — the saucer (three bars turning on the same side of zero), the zero cross, twin peaks — read as shifts in the short average's lead over the long one.
How the zero cross fails. It is two simple averages crossing — late by the lag of a 34-bar average, and frequent in a range.
How the saucer and twin peaks fail. Williams' patterns of three bars or two peaks are short sequences in a jagged histogram; they occur constantly, and most are followed by nothing of note.
09In different markets and timeframes
The Awesome Oscillator is a simple momentum histogram — a 5-bar against a 34-bar average of the bar's midpoint. It trends well and alternates in ranges. Its colour is its direction, not its sign.
10With other studies
Read with the Accelerator (its own short-term change) and the Alligator, in Williams' set.
11What it does not tell you
It is a difference of two averages, like MACD with simple averages, and describes their gap.
12Inputs and defaults
- 1Fast period — 5The short average of the median price (5).
- 2Slow period — 34The long average (34). Williams used these two and nothing else; changing them makes a different study with the same name.
- 3Timeframe — ChartThe chart's own by default; any higher one, read on the last closed candle. A finer one is never offered.
- 4Wait for the candle to close — OnThe value of a higher timeframe is taken only from a candle that has finished.
The settings in use
- In use5 and 34 are Williams' numbers; changing them makes another study.
13Limits and common misreadings
In price units, not comparable between instruments.
Simple averages: a bar leaving the 34-bar window moves the value as much as a new one entering.
The colour is not the sign. A bar in the rising colour below zero is a negative value that rose.
14Conditions an alert or a strategy can watch
an event happens on one bar a state holds on every bar while it lasts
These are the conditions the study itself declares — the same rules the alert editor and the strategy engine read, and the ones the figure's chips show.
15Practise it in the laboratory
Put AO under a chart and mark every zero crossing over a few hundred bars; count how many were followed by a move larger than the bars just before the crossing.
Open the laboratory17On pages of their own
18In Bentrix
- From the menu: a chart's Indicators button › Bill Williams › Awesome Oscillator, or type Awesome Oscillator in its search.
- Its settings: the settings card opens when it is added; its legend's name opens it again.
19From an agent or a program
Two tools reach it. study_values computes it over a workbench’s candles up to the clock — no chart needed — and study_attach puts it on a chart, where it is drawn and saved with the chart ({"chart": "<chart uri>", "kind": "ao"}).
The study, as a chart files it
This is a new Awesome Oscillator’s entry — its kind, its calculation, the price it reads and its settings. Change a setting here to read it with other inputs.
{
"applied": "close",
"convention": "talib",
"kind": "ao",
"settings": {
"fast": 5,
"shape": "fast_slow",
"slow": 34
}
}An agent
An agent calls the MCP tool with it:
{
"name": "study_values",
"arguments": {
"bench": "bentrix://lab/\u2026/bench/\u2026",
"symbol": "EURUSD",
"timeframe": "H1",
"limit": 5,
"study": {
"applied": "close",
"convention": "talib",
"kind": "ao",
"settings": {
"fast": 5,
"shape": "fast_slow",
"slow": 34
}
}
}
}A program
A program does the same in its language — bench and market as in the built-in indicators guide:
Python
values = client.study.values(bench, market, "H1", {"applied": "close", "convention": "talib", "kind": "ao", "settings": {"fast": 5, "shape": "fast_slow", "slow": 34}}, limit=5)
print("times:", values["times"])
for line in values["lines"]:
print("line:", line["line"])
print(" newest values:", line["values"])JavaScript
const values = await client.study.values({ bench, symbol: market, timeframe: "H1", study: { "applied": "close", "convention": "talib", "kind": "ao", "settings": { "fast": 5, "shape": "fast_slow", "slow": 34 } }, limit: 5 });
console.log("times:", values.times);
for (const line of values.lines) {
console.log("line:", line.line);
console.log(" newest values:", line.values);
}C#
var values = await client.Study.Values(bench, market, "H1", new Dictionary<string, object?> { ["applied"] = "close", ["convention"] = "talib", ["kind"] = "ao", ["settings"] = new Dictionary<string, object?> { ["fast"] = 5, ["shape"] = "fast_slow", ["slow"] = 34 } }, limit: 5);
Console.WriteLine($"times: {values!["times"]!}");
foreach (var line in values!["lines"]!.AsArray())
{
Console.WriteLine($"line: {line!["line"]!}");
Console.WriteLine($" newest values: {line!["values"]!}");
}Go
values := must(client.Study.Values(ctx, mcp.StudyValuesArgs{Bench: bench, Symbol: market, Timeframe: "H1", Study: map[string]any{"applied": "close", "convention": "talib", "kind": "ao", "settings": map[string]any{"fast": 5, "shape": "fast_slow", "slow": 34}}, Limit: mcp.Ptr[int64](5)}))
fmt.Println("times:", at(values, "times"))
for _, line := range at(values, "lines").([]any) {
fmt.Println("line:", at(line, "line"))
fmt.Println(" newest values:", at(line, "values"))
}Java
Object values = client.study.values(new Bentrix.StudyApi.ValuesArgs(bench, market, "H1", obj("applied", "close", "convention", "talib", "kind", "ao", "settings", obj("fast", 5, "shape", "fast_slow", "slow", 34))).limit(5L));
System.out.println("times:" + " " + at(values, "times"));
for (Object line : (List<Object>) at(values, "lines")) {
System.out.println("line:" + " " + at(line, "line"));
System.out.println(" newest values:" + " " + at(line, "values"));
}C++
auto values = client.study.values_(StudyApi::ValuesArgs(bench, market, "H1", Json::Object{{"applied", "close"}, {"convention", "talib"}, {"kind", "ao"}, {"settings", Json::Object{{"fast", 5}, {"shape", "fast_slow"}, {"slow", 34}}}}).limit(5));
std::cout << "times:" << " " << values["times"].dump() << std::endl;
for (const Json &line : values["lines"].arr()) {
std::cout << "line:" << " " << line["line"].dump() << std::endl;
std::cout << " newest values:" << " " << line["values"].dump() << std::endl;
}Julia
values = client.study.values(bench, market, "H1", Dict{String,Any}("applied" => "close", "convention" => "talib", "kind" => "ao", "settings" => Dict{String,Any}("fast" => 5, "shape" => "fast_slow", "slow" => 34)); limit = 5)
println("times:", " ", values["times"])
for line in values["lines"]
println("line:", " ", line["line"])
println(" newest values:", " ", line["values"])
endR
values <- client$study$values(bench, market, "H1", list(applied = "close", convention = "talib", kind = "ao", settings = list(fast = 5, shape = "fast_slow", slow = 34)), limit = 5)
cat("times:", format(values$times), "\n")
for (line in values$lines) {
cat("line:", format(line$line), "\n")
cat(" newest values:", format(line$values), "\n")
}Rust
let values = client.study().values(mcp::StudyValuesArgs::new(bench.clone(), market.clone(), "H1", serde_json::json!({"applied": "close", "convention": "talib", "kind": "ao", "settings": {"fast": 5, "shape": "fast_slow", "slow": 34}})).limit(5))?;
println!("times: {}", values["times"]);
for line in values["lines"].as_array().into_iter().flatten() {
println!("line: {}", line["line"]);
println!(" newest values: {}", line["values"]);
}Reading the answer
times— the candles’ open times, in milliseconds since 1970 (UTC), oldest first.lines— one entry per line, in this order, each with itslinename and itsvalues;values[i]belongs to the candle attimes[i].- The last value is the candle at the clock’s, which may still be forming: it changes until that candle closes, as on the chart. Nothing after the clock is ever computed.
nullis a candle with no value yet — the warm-up, about 1 × the period at the start of the history.- Its fixed levels, drawn on the chart:
[0.0].
line | What it is |
|---|---|
Main | the indicator's own value |
In a strategy
Filed under a key of your choice in a strategy document’s studies — here ao: {"ao": {"applied": "close", "convention": "talib", "kind": "ao", "settings": {"fast": 5, "shape": "fast_slow", "slow": 34}}} — its rules can name:
| Write | What it is |
|---|---|
ao | its main line, as a value in a compare |
{"cond": "ao:level.cross_up:0"} | a condition it declares itself |
{"cond": "ao:level.cross_down:0"} | a condition it declares itself |
{"cond": "ao:level.above:0"} | a condition it declares itself |
{"cond": "ao:level.below:0"} | a condition it declares itself |
{"cond": "ao:histogram.turns_up"} | a condition it declares itself |
{"cond": "ao:histogram.turns_down"} | a condition it declares itself |
20Sources
- Williams, Bill. New Trading Dimensions. Wiley, 1998.
Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed