Awesome Oscillator free

by akispro in category Oscilator at 16/06/2012
Description

Awesome Oscillator shows the difference in between the 5 SMA and 34 SMA.
If to be precise, 5 SMA of midpoints is subtracted from 34 SMA of midpoints which allows to see the market momentum.

Awesome Oscillator

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
    public class AwesomeOscillator : Indicator
    {
        [Parameter(DefaultValue = 5)]
        public int periodFast { get; set; }

        [Parameter(DefaultValue = 34)]
        public int periodSlow { get; set; }

        [Output("Awesome OscillatorGreen", IsHistogram = true, Color = Colors.Green)]
        public IndicatorDataSeries AwesomeGreen { get; set; }

        [Output("Awesome OscillatorRed", IsHistogram = true, Color = Colors.Red)]
        public IndicatorDataSeries AwesomeRed { get; set; }

        private SimpleMovingAverage smaSlow;
        private SimpleMovingAverage smaFast;
        private IndicatorDataSeries medianprice;

        protected override void Initialize()
        {
            medianprice = CreateDataSeries();
            smaSlow = Indicators.SimpleMovingAverage(medianprice, periodSlow);
            smaFast = Indicators.SimpleMovingAverage(medianprice, periodFast);
        }

        public override void Calculate(int index)
        {
            medianprice[index] = (MarketSeries.High[index] + MarketSeries.Low[index]) / 2;
            double previousAO = smaFast.Result[index - 1] - smaSlow.Result[index - 1];
            double currentAO = smaFast.Result[index] - smaSlow.Result[index];
            
            if (previousAO >= currentAO)
            {
                AwesomeRed[index] = smaFast.Result[index] - smaSlow.Result[index];
            }
            else
            {
                AwesomeGreen[index] = smaFast.Result[index] - smaSlow.Result[index];
            }
        }
    }
}
Comments

Ruslan - July 11, 2012 @ 15:30

does not work writes that it is necessary to use use plottype = plottype.histogram

Ruslan - July 11, 2012 @ 16:12

I do not know how well corrected the code, the indicator works using System; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo.Indicators { [Indicator(IsOverlay = false)] public class NewIndicator : Indicator { [Parameter(DefaultValue = 5)] public int periodFast { get; set; } [Parameter(DefaultValue = 34)] public int periodSlow { get; set; } [Output("Awesome OscillatorGreen", Color = Colors.Green, PlotType=PlotType.Histogram)] public IndicatorDataSeries AwesomeGreen { get; set; } [Output("Awesome OscillatorRed", Color = Colors.Red, PlotType=PlotType.Histogram)] public IndicatorDataSeries AwesomeRed { get; set; } private SimpleMovingAverage smaSlow; private SimpleMovingAverage smaFast; private IndicatorDataSeries medianprice; protected override void Initialize() { medianprice = CreateDataSeries(); smaSlow = Indicators.SimpleMovingAverage(medianprice,periodSlow); smaFast = Indicators.SimpleMovingAverage(medianprice,periodFast); } public override void Calculate(int index) { medianprice[index] = (MarketSeries.High[index] + MarketSeries.Low[index])/2; double previousAO = smaFast.Result[index-1] - smaSlow.Result[index-1]; double currentAO = smaFast.Result[index] - smaSlow.Result[index]; if(previousAO>=currentAO){ AwesomeRed[index] = smaFast.Result[index] - smaSlow.Result[index]; }else{ AwesomeGreen[index] = smaFast.Result[index] - smaSlow.Result[index]; } } } }

Abhi - February 01, 2018 @ 08:40

Great one. is it possible to draw a vertical line when the AO crosses above or below 0. So we don't have to look at the AO. The vertical lines will tell when the bull or bear cycle is changing.

5