Category Other  Published on 18/09/2016

Cyf_Elder's_Impulse

Description

Developed by Alexander Elder 

The idea of Impulse is measuring any market by Inertia & Power according to Elder

Inertia can be measured by the slope of a fast EMA

Power can be measured by the slope of MACD Histogram 

If both are increasing in value ----> UP Trend 

if both are decreasing in value----> Dn Trend

When they are different (one is increasing & the other is decreasing) .. its No trade or a Market Turn . 

 

The last usage of this indicator by Alexander Elder is a Censorship indicator !

i.e.   If Both dots are Green/White/Up on daily chart .... no intra-day Shorts should be taken .. only Long Trades

        if Both dots are Red/Dn on daily chart .. no intra-day Longs should be taken .. only short Trades . 

 


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

namespace cAlgo
{
    [Indicator(IsOverlay = false, ScalePrecision = 0, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Cyf_Impulse : Indicator
    {
        private string Bullet = "●";
        private VerticalAlignment vAlign = VerticalAlignment.Center;
        private HorizontalAlignment hAlign = HorizontalAlignment.Center;
        private ExponentialMovingAverage EMA;
        private MacdHistogram Mac;
        private Colors UpColor = Colors.White;
        private Colors DnColor = Colors.Crimson;


        [Parameter("UpColor", DefaultValue = "White")]
        public string upColor { get; set; }

        [Parameter("DnColor", DefaultValue = "Crimson")]
        public string dnColor { get; set; }

        [Parameter(DefaultValue = 13)]
        public int Period { get; set; }

        [Parameter("LongCycle", DefaultValue = 26)]
        public int LongCycle { get; set; }

        [Parameter("ShrtCycle", DefaultValue = 12)]
        public int ShrtCycle { get; set; }

        [Parameter("Signal", DefaultValue = 9)]
        public int Signal { get; set; }


        protected override void Initialize()
        {
            Enum.TryParse(upColor, out UpColor);
            Enum.TryParse(dnColor, out DnColor);
            EMA = Indicators.ExponentialMovingAverage(MarketSeries.Close, Period);
            Mac = Indicators.MacdHistogram(LongCycle, ShrtCycle, Signal);

        }

        public override void Calculate(int index)
        {
            if (EMA.Result[index] > EMA.Result[index - 1] && Mac.Histogram[index] > Mac.Histogram[index - 1])
            {
                ChartObjects.DrawText("EMA_Dots" + index, Bullet, index, 0.5, vAlign, hAlign, UpColor);
                ChartObjects.DrawText("MAC_Dots" + index, Bullet, index, 0.7, vAlign, hAlign, UpColor);
            }

            else if (EMA.Result[index] < EMA.Result[index - 1] && Mac.Histogram[index] < Mac.Histogram[index - 1])
            {
                ChartObjects.DrawText("EMA_Dots" + index, Bullet, index, 0.5, vAlign, hAlign, DnColor);
                ChartObjects.DrawText("MAC_Dots" + index, Bullet, index, 0.7, vAlign, hAlign, DnColor);
            }
            else
            {
                ChartObjects.DrawText("EMA_Dots" + index, Bullet, index, 0.5, vAlign, hAlign, Colors.Black);
                ChartObjects.DrawText("MAC_Dots" + index, Bullet, index, 0.7, vAlign, hAlign, Colors.Black);

            }



        }
    }
}


cyfer's avatar
cyfer

Joined on 27.09.2015

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Cyf_Elder's_Impulse.algo
  • Rating: 5
  • Installs: 3445
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
Kayed's avatar
Kayed · 1 year ago

Wrong inputs!! the MACD Histogram in Ctrader turns Macd line into columns and thats not a MACD histogram:
MACD Histogram= MACD line - Signal line
therefor: the Impulse system here is taking the wrong inputs which is the MACD line instead of the MACD Histogram. and this will lead to a late signal. 
Any way, there's another indicator in ctrader that gives the right inputs which is (MACD crossover). 

KI
KirillKharchenko · 7 years ago

Thanks, but how change color of black signal on black background?

SE
Serpico · 8 years ago

Thanks for sharing this great indicator, is it possible to have the option to choose the desired time frame to show,