Double Exponential Moving Average (DEMA) free

by Doustzadeh in category Trend at 03/12/2021
Description

The Double Exponential Moving Average (DEMA) reduces the lag of traditional EMAs, making it more responsive and better-suited for short-term traders. DEMA was developed by Patrick Mulloy, and introduced in the January 1994 issue of Technical Analysis of Stocks & Commodities magazine.

The overlay uses the lag difference between a single-smoothed EMA and a double-smoothed EMA to offset the single-smoothed EMA. This offset produces a moving average that remains smooth, but stays closer to the price bars than either the single- or double-smoothed traditional EMA.

 

Github: GitHub - Doustzadeh/cTrader-Indicator

 

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 cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, AutoRescale = false, AccessRights = AccessRights.None)]
    public class DoubleExponentialMovingAverage : Indicator
    {
        // Single and Double-Smoothed EMAs:
        // EMA1 = EMA of price
        // EMA2 = EMA of EMA1
        // DEMA = (2 x EMA1) - EMA2

        [Parameter("Source")]
        public DataSeries Source { get; set; }

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

        [Output("DEMA", LineColor = "DodgerBlue", Thickness = 2)]
        public IndicatorDataSeries DEMA { get; set; }

        private ExponentialMovingAverage EMA1, EMA2;

        protected override void Initialize()
        {
            EMA1 = Indicators.ExponentialMovingAverage(Source, Periods);
            EMA2 = Indicators.ExponentialMovingAverage(EMA1.Result, Periods);
        }

        public override void Calculate(int index)
        {
            DEMA[index] = (2 * EMA1.Result[index]) - EMA2.Result[index];
        }
    }
}
Comments

wadehooper9220542 - July 04, 2022 @ 11:32

I found your sharing to be very helpful, and I hope to read more of your writing in the future. Additionally, I found a fantastic game called kogama squid that you may play with me if you have the time.

wadehooper9220542 - July 04, 2022 @ 11:32

I found your sharing to be very helpful, and I hope to read more of your writing in the future. Additionally, I found a fantastic game called kogama squid that you may play with me if you have the time.

junealexis001 - September 12, 2022 @ 12:38

Interesting site i love it keep posting more!  bathroom remodeling amarillo

0