Awesome Oscillator (AO) is the difference between the 34 period and 5 period simple moving averages of the candle’s/ bar’s middle points. Basically: (High+Low) / 2.
AO Indicator calculates and determines market momentum at a given time when comparing the last five bars to last thirty four bars.
Awesome Oscillator (AO) is displayed on the chart as a histogram. Awesome Oscillator can present us with three buy signals and also three sell signals, but its not recommended to use them until the first fractal buy or sell signal is triggered outside the Alligator's mouth.
CALCULATION:
MEDIAN = (HIGH+LOW)/2
AO = MVA(MEDIAN, 5) - MVA(MEDIAN, 34)
SCREENSHOT:
Download indicator (New version):
Apr, 13 2010, ng:
In the new version of the indicator:
1) By default the covering line is not shown. An additional parameter is added to show the covering line (It may be useful for applying indicator on the AO results or for using the indicators
in another indicator).
2) In case the bar has the same size as the previous bar, the bar will have the same color (in the previous version the equal bar was always green).
- Code: Select all
function Init()
indicator:name("Awesome Oscillator");
indicator:description("");
indicator:requiredSource(core.Bar);
indicator:type(core.Oscillator);
indicator.parameters:addInteger("FM", "Fast Moving Average", "The number of periods to calculate the fast moving average of the median price", 5, 2, 10000);
indicator.parameters:addInteger("SM", "Slow Moving Average", "The number of periods to calculate the slow moving average of the median price", 35, 2, 10000);
indicator.parameters:addBoolean("SC", "Show the covering line", "Shows line trough the tops of bars", false);
indicator.parameters:addColor("CL_color", "Color for covering line", "Color for covering line", core.rgb(255, 255, 255));
indicator.parameters:addColor("GO_color", "Color for higher bars", "Color for higher bars", core.rgb(0, 255, 0));
indicator.parameters:addColor("RO_color", "Color for lower bars", "Color for lower bars", core.rgb(255, 0, 0));
end
local FM;
local SM;
local SC;
local first;
local source = nil;
-- Streams block
local CL = nil;
local GO = nil;
local RO = nil;
local MEDIAN = nil;
local FMVA = nil;
local SMVA = nil;
function Prepare()
FM = instance.parameters.FM;
SM = instance.parameters.SM;
SC = instance.parameters.SC;
assert(FM < SM, "Fast moving average parameter must be less than slow moving average");
source = instance.source;
first = source:first() + SM;
-- Create the median stream
MEDIAN = instance:addInternalStream(0, 0);
FMVA = core.indicators:create("MVA", MEDIAN, FM);
SMVA = core.indicators:create("MVA", MEDIAN, SM);
local name = profile:id() .. "(" .. source:name() .. ", " .. FM .. ", " .. SM .. ")";
instance:name(name);
if SC then
CL = instance:addStream("AO", core.Line, name .. ".AO", "AO", instance.parameters.CL_color, first);
else
CL = instance:addInternalStream(first, 0);
end
GO = instance:addStream("GO", core.Bar, name .. ".GO", "GO", instance.parameters.GO_color, first);
RO = instance:addStream("RO", core.Bar, name .. ".RO", "RO", instance.parameters.RO_color, first);
if SC then
CL:addLevel(0);
else
GO:addLevel(0);
end
end
function Update(period, mode)
MEDIAN[period] = (source.high[period] + source.low[period]) / 2;
FMVA:update(mode);
SMVA:update(mode);
if (period >= first) then
CL[period] = FMVA.DATA[period] - SMVA.DATA[period];
end
if (period >= first + 1) then
if (CL[period] > CL[period - 1]) then
GO[period] = CL[period];
elseif (CL[period] < CL[period - 1]) then
RO[period] = CL[period];
elseif GO[period - 1] > 0 then
GO[period] = CL[period];
else
RO[period] = CL[period];
end
end
end
Old version:
Tags: Awesome, indicator, Marketscope, Trading Station, FXCM, dbFX