EMA Indicator

Created at 26 May 2020, 14:06
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AJ

ajmal-ali

Joined 26.05.2020

EMA Indicator
26 May 2020, 14:06


Hello,

I am looking to add additional EMA trend indictor at various levels, 200,100,50,28.

I have managed to add EMA indictor but unsure how to go about the different levels?

Thank you for your time.


@ajmal-ali
Replies

PanagiotisCharalampous
26 May 2020, 14:16

Hi ajmal-ali,

It is not clear what do you mean with levels. Can you please explain?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

ajmal-ali
26 May 2020, 14:32

RE:

PanagiotisCharalampous said:

Hi ajmal-ali,

It is not clear what do you mean with levels. Can you please explain?

Best Regards,

Panagiotis 

Join us on Telegram

 

Thank you for the prompt response

Basically I am wanting to add on my Ctrader chart the following:

200 EMA trend line
100 EMA trend line
50 EMA trend line
28 EMA trend line

I have found the indictor of EMA but that only provides one trend line out of the four

Much appreciated


@ajmal-ali

PanagiotisCharalampous
26 May 2020, 14:36

Hi ajmal-ali,

You can add several indicators on your chart at the same time.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

ajmal-ali
26 May 2020, 14:46

RE:

PanagiotisCharalampous said:

Hi ajmal-ali,

You can add several indicators on your chart at the same time.

Best Regards,

Panagiotis 

Join us on Telegram

Thank you for the information.

I am aware of how to add the EMA trend line, but I would like to know how to add another EMA trend line configured at 100 level for example?

Much appreciated


@ajmal-ali

Symposium
27 May 2020, 07:14 ( Updated at: 21 Dec 2023, 09:22 )

RE: Quad(4) MA Indicator........

Add's all 4 EMA's to your chart, MA Type can be changed to SMA, EMA, TMA, WMA, WWMA or VIDYA Style...... Hope this helps.....

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class QuadMAIndicator : Indicator
    {

        [Parameter(DefaultValue = 28)]
        public int Period1 { get; set; }

        [Parameter(DefaultValue = 50)]
        public int Period2 { get; set; }

        [Parameter(DefaultValue = 100)]
        public int Period3 { get; set; }

        [Parameter(DefaultValue = 200)]
        public int Period4 { get; set; }

        [Parameter("Moving Average Type", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MAType { get; set; }

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

        [Output("28 MA", Color = Colors.Lime, LineStyle = LineStyle.Lines, Thickness = 2)]
        public IndicatorDataSeries Result1 { get; set; }

        [Output("50 MA", Color = Colors.Green, LineStyle = LineStyle.Lines, Thickness = 2)]
        public IndicatorDataSeries Result2 { get; set; }

        [Output("100 MA", Color = Colors.Red, LineStyle = LineStyle.Lines, Thickness = 2)]
        public IndicatorDataSeries Result3 { get; set; }

        [Output("200 MA", Color = Colors.DarkRed, LineStyle = LineStyle.Lines, Thickness = 2)]
        public IndicatorDataSeries Result4 { get; set; }

        private MovingAverage _MovingAverage1;
        private MovingAverage _MovingAverage2;
        private MovingAverage _MovingAverage3;
        private MovingAverage _MovingAverage4;


        protected override void Initialize()
        {
            _MovingAverage1 = Indicators.MovingAverage(Source, Period1, MAType);
            _MovingAverage2 = Indicators.MovingAverage(Source, Period2, MAType);
            _MovingAverage3 = Indicators.MovingAverage(Source, Period3, MAType);
            _MovingAverage4 = Indicators.MovingAverage(Source, Period4, MAType);

        }

        public override void Calculate(int index)
        {

            Result1[index] = _MovingAverage1.Result[index];
            Result2[index] = _MovingAverage2.Result[index];
            Result3[index] = _MovingAverage3.Result[index];
            Result4[index] = _MovingAverage4.Result[index];
        }
    }
}

 


@Symposium