Still have questions?
Contact support

# Awesome Oscillator

## Overview

The Awesome Oscillator (AO) was created by Bill Williams. The Awesome Oscillator is an indicator used to measure market momentum. The Awesome Oscillator indicator is a histogram, it is similar to the MACD indicator - displaying the market momentum of a recent number of periods compared to the momentum of a larger number of previous periods. AO calculates the difference between a 34 Period and 5 Period Simple Moving Average. The Simple Moving Averages that are used are not calculated using closing price but rather each bar's midpoints. AO is generally used to affirm trends or to anticipate possible reversals. If the AO histogram is crossing above the zero line that's indicative of bullish momentum, reverse is true as well - when AO crosses below that's indicative of bearish momentum.

Mathematical description: Awesome Oscillator (AO) Mathematical Description.

Awesome Oscillator indicator is added using ao() method. It requires a mapping with two fields: `"high"` and `"low"`.

``````// create data table on loaded data
var dataTable = anychart.data.table();

var mapping = dataTable.mapAs({"open": 1, "high": 2, "low": 3, "close": 4});

// create stock chart
var chart = anychart.stock();

// create the first plot on the chart
var plot_0 = chart.plot(0);

// create ohlc series
var ohlcSeries = plot_0.ohlc(mapping);

// create the second plot on the chart
var plot_1 = chart.plot(1);

// create an Awesome Oscillator indicator
var ao = plot_1.ao(mapping);
``````

Here is a live sample:

## Indicator Parameters

There are four parameters an Awesome Oscillator indicator has, one of them is necessary - the mapping. The second parameter and third parameters set period, fourth - Moving Average Type. The last parameter sets the series type. The following code sample demonstrates an Awesome Oscillator indicator with parameters set as default:

``````var ao = plot.ao(mapping, 5, 34, "sma", "stick");
``````

The series type can be easily changed any time using the seriesType() method.

## Visualization

Vizualization of an indicator depends on the type of a series you display it with. Here is a sample where Awesome Oscillator indicators with different parameters and settings are added to different plots:

``````// create and adjust an Awesome Oscillator indicator
var ao_1 = chart.plot(1).ao(mapping).series();
ao_1.risingStroke("#33ccff");
ao_1.fallingStroke("#ff33cc");

// create and adjust an Awesome Oscillator indicator
var ao_2 = chart.plot(2).ao(mapping, 15, 44, "sma", "area").series();
ao_2.risingStroke(null);
ao_2.fallingStroke(null);
ao_2.risingFill("#37474f");
ao_2.fallingFill("#90a4ae");
``````

Live sample: