Double Ema Trend free

by duongss.trade in category Trend at 20/11/2022
Description
Let me present it briefly.
This is the trend for the chart from 2H and above.

The Turquoise line is for the current trend if it crosses the Black line.

The purpose of the indicator is for you to identify the exact trend

 

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;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
    public class DoubleEMAtrend : Indicator
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

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

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

        [Output("trend", LineColor = "Turquoise", LineStyle = LineStyle.LinesDots,Thickness = 2)]
        public IndicatorDataSeries Result { get; set; }

        [Output("base",IsHistogram =false, LineColor = "Black", LineStyle = LineStyle.LinesDots ,Thickness = 2)]
        public IndicatorDataSeries ResultBase { get; set; }

        private double expTrend;
        private double expBase;
     
        protected override void Initialize()
        {
            expTrend = 2.0 / (PeriodsTrend + 1);
            expBase = 2.0 / (PeriodsBase + 1);
       
        }

        public override void Calculate(int index)
        {
       
            var previousValue = Result[index - 1];

            if (double.IsNaN(previousValue))
                Result[index] = Source[index];
            else
                Result[index] = Source[index] * expTrend + previousValue * (1 - expTrend);
                
                
            var previousValueBase = ResultBase[index - 1];
            
            if (double.IsNaN(previousValueBase))
                ResultBase[index] = Source[index];
            else
                ResultBase[index] = Source[index] * expBase + previousValueBase * (1 - expBase);
        }
    }
}
Comments

alexreynolds0831 - November 23, 2022 @ 04:39

Im no expert, but I believe you just made an excellent point. You know exactly what you're talking about, and I can totally agree with you quordle

 

anna.stark266 - November 23, 2022 @ 06:26

Thank you for producing such a fascinating essay on this subject. This has sparked a lot of thought in me, and I'm looking forward to reading more. Retro Bowl game unblocked 

lazurchenkovladyslav - December 02, 2022 @ 02:31

Very interesting. Thank you for posting it. You should check this post here. 

0