AW Macd +MacdLine free

by khoshroomahdi in category Oscilator at 31/08/2022
Description

some user add moving average to macd to see better.

in ctrader 4.3.11 there is a problem with this .

I make a macd that have macdline for that users.

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

namespace cAlgo
{

    [Levels(0)]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class AWMacdColor : Indicator
    {

        public MacdHistogram _Macd;

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

        [Parameter("Long Cycle 1", DefaultValue = 26)]
        public int LongCycle1 { get; set; }

        [Parameter("Short Cycle 1", DefaultValue = 12)]
        public int ShortCycle1 { get; set; }

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

        [Output("Macd ", LineColor = "FF33C1F3", Thickness = 2, PlotType = PlotType.Histogram)]
        public IndicatorDataSeries Macd { get; set; }

[Output("Macd Line ", LineColor = "Black", Thickness = 2, PlotType = PlotType.Line)]
        public IndicatorDataSeries MacdLine { get; set; }
        

        [Output("Signal", LineColor = "Red", Thickness = 2, PlotType = PlotType.Line)]
        public IndicatorDataSeries Signal { get; set; }

        protected override void Initialize()
        {

            _Macd = Indicators.MacdHistogram(Source, LongCycle1, ShortCycle1, inpSingal1);

        }

        public override void Calculate(int index)
        {

            Macd[index] = _Macd.Histogram[index];
            MacdLine[index] = _Macd.Histogram[index];
            Signal[index] = _Macd.Signal[index];



        }
    }
}
Comments
0