Category Other  Published on 04/03/2021

OrglobalFx Waddah Attah Edited_v1.1

Description

OrglobalFx_Waddah_Attah_Edited_v1.1 

Updated version of : https://ctrader.com/algos/indicators/show/2606

orglobalng@gmail.com
 Reference from Waddah Attah Explosion  

Feature

  •  Waddah Attah based on a different calculation

/////////////////////////////////////////////////////////////////
//OrglobalFx_Waddah_Attah_Edited_v1_1 
// orglobalng@gmail.com
// Reference from Waddah Attah Explosion                       
//
////////////////////////////////////////////////////////////////



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

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class OrglobalFx_Waddah_Attah_Edited_v1_1 : Indicator
    {
        [Parameter("Sensitivity", DefaultValue = 150, Group = "WAE")]
        public int Sensitivity { get; set; }
        [Parameter("Fast EMA", DefaultValue = 26, Group = "WAE")]
        public int FastEMA { get; set; }
        [Parameter("Slow EMA", DefaultValue = 52, Group = "WAE")]
        public int SlowEMA { get; set; }
        [Parameter("Channel Period", DefaultValue = 20, Group = "WAE")]
        public int BBPeriod { get; set; }
        [Parameter("Channel Multiplier", DefaultValue = 4, Group = "WAE")]
        public double BBMultiplier { get; set; }
        [Parameter("DeadZonePip", DefaultValue = 200, Group = "WAE")]
        public int DeadZonePip { get; set; }

        [Output("UpTrend", LineColor = "Lime", PlotType = PlotType.Histogram, Thickness = 5)]
        public IndicatorDataSeries Uptrend { get; set; }
        [Output("DownTrend", LineColor = "Red", PlotType = PlotType.Histogram, Thickness = 5)]
        public IndicatorDataSeries Downtrend { get; set; }
        [Output("Explosion Line", LineColor = "Yellow", Thickness = 1)]
        public IndicatorDataSeries Explosion { get; set; }
        [Output("Dead Line", LineColor = "White", Thickness = 1)]
        public IndicatorDataSeries Dead { get; set; }

        public IndicatorDataSeries Result;
        private MacdCrossOver iMACD;
        private BollingerBands iBands;
        private double trendup, trenddown, explode1, explode2, Dead1;

        protected override void Initialize()
        {
            Result = CreateDataSeries();

            iMACD = Indicators.MacdCrossOver(SlowEMA, FastEMA, 9);
            iBands = Indicators.BollingerBands(Bars.ClosePrices, BBPeriod, BBMultiplier, MovingAverageType.Weighted);
        }

        public override void Calculate(int index)
        {
            trendup = (iMACD.MACD[index] - iMACD.MACD[index - 1]) * Sensitivity;
            trenddown = (iMACD.MACD[index - 1] - iMACD.MACD[index - 2]) * Sensitivity;

            explode1 = (iBands.Top[index] - iBands.Bottom[index]);
            explode2 = (iBands.Top[index - 1] - iBands.Bottom[index - 1]);

            Dead1 = Symbol.PipSize * DeadZonePip / 10;

            if (trendup >= 0 && iMACD.Histogram[index] > 0)
            {
                Uptrend[index] = trendup;
                Downtrend[index] = 0;

            }

            if (trendup < 0 && iMACD.Histogram[index] < 0)
            {
                Downtrend[index] = (-1 * trendup);
                Uptrend[index] = 0;

            }

            Explosion[index] = explode1;
            Dead[index] = Dead1;
        }
    }
}


Orglobalfx01's avatar
Orglobalfx01

Joined on 03.03.2021

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: OrglobalFx_Waddah_Attah_Edited_v1_1.algo
  • Rating: 5
  • Installs: 1642
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
DO
dominic.penny.21 · 3 years ago

Thank you for this.