Category Oscilators  Published on 23/05/2016

Cyf_Ergodic_Candlestick_Oscillator

Description

William Blau's Ergodic CandleStick Oscillator  written for cTrader.

-This is another Momentum based Indicator , It Ignores Gaps (if you trade Stocks) and measures the candlestick tendency 

-Above 0 Line , you're a Bull and below it you're a Bear 

-The Hype about this one is its the fastest indicator to show a trend reversal 

Use at your own Risk

-You Can Choose between Line and Histogram from the settings window 

 

 

 


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None, ScalePrecision = 0)]
    public class Cyf_Ergodic_Candlestick_Oscillator : Indicator
    {
        private ExponentialMovingAverage EMA_CO;
        private ExponentialMovingAverage EMA_CO_S;
        private ExponentialMovingAverage EMA_HL;
        private ExponentialMovingAverage EMA_HL_S;
        private IndicatorDataSeries CO_Series;
        private IndicatorDataSeries HL_Series;
        private double CO_Val;
        private double HL_Val;
        private double ECO;

        [Parameter(DefaultValue = 32, MinValue = 1)]
        public int Interval_1 { get; set; }

        [Parameter(DefaultValue = 12, MinValue = 1)]
        public int Interval_2 { get; set; }

        [Parameter("(Y)Line/(N)Hist", DefaultValue = true)]
        public bool Line { get; set; }

        [Output("ECO_Line", PlotType = PlotType.Line)]
        public IndicatorDataSeries ECO_Line { get; set; }

        [Output("ECO_Hist_Up", Color = Colors.White, PlotType = PlotType.Histogram, Thickness = 2)]
        public IndicatorDataSeries ECO_Hist_Up { get; set; }

        [Output("ECO_Hist_Dn", Color = Colors.DodgerBlue, PlotType = PlotType.Histogram, Thickness = 2)]
        public IndicatorDataSeries ECO_Hist_Dn { get; set; }

        protected override void Initialize()
        {
            CO_Series = CreateDataSeries();
            HL_Series = CreateDataSeries();

            EMA_CO = Indicators.ExponentialMovingAverage(CO_Series, Interval_1);
            EMA_CO_S = Indicators.ExponentialMovingAverage(EMA_CO.Result, Interval_2);

            EMA_HL = Indicators.ExponentialMovingAverage(HL_Series, Interval_1);
            EMA_HL_S = Indicators.ExponentialMovingAverage(EMA_HL.Result, Interval_2);

        }

        public override void Calculate(int index)
        {
            CO_Val = double.NaN;
            HL_Val = double.NaN;

            CO_Val = MarketSeries.Close[index] - MarketSeries.Open[index];
            HL_Val = MarketSeries.High[index] - MarketSeries.Low[index];

            CO_Series[index] = CO_Val;
            HL_Series[index] = HL_Val;

            ECO = 100 * (EMA_CO_S.Result[index] / EMA_HL_S.Result[index]);

            if (Line)
            {
                ECO_Line[index] = ECO;
            }
            else
            {
                if (ECO > 0)
                {
                    ECO_Hist_Up[index] = ECO;
                }
                else
                {
                    ECO_Hist_Dn[index] = ECO;
                }

            }


        }
    }
}


cyfer's avatar
cyfer

Joined on 27.09.2015

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Cyf_Ergodic_Candlestick_Oscillator.algo
  • Rating: 0
  • Installs: 2990
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
CA
calmfocusedmind@gmail.com · 5 years ago

Hello cyfer, greetings from Indonesia. Thank you for coding this indicator. I would like to know, what is the interval 1 and interval 2 goes for ? thank you

Regards

Bagus