Category Other  Published on 31/05/2023

Macd Cloud ON Chart

Description

This is what the MACD looks like set onto a chart.

Using the BARS close as the center line

the orange line in this picture is a MA set to 1 for refferance


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

namespace cAlgo
{
      [Cloud ( "Macd", "Signal", Opacity = 1 , FirstColor = "Macd", SecondColor = "Signal")]
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class MACDON : Indicator

     {    // Bar Colours are #CCFFFF00 and #FF552277

        public DataSeries Source { get; set; }

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

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

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

        [Output("Macd", LineColor = "4400AA00",Thickness =1, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Macd {get;set;}

        [Output("Signal", LineColor = "44AA0000",Thickness =1, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Signal {get;set;}

        private MacdCrossOver macdCrossOver;

        protected override void Initialize()
        {
          

           macdCrossOver = Indicators.MacdCrossOver(LongCycle, ShortCycle, Periods);
           
        }

        public override void Calculate(int index)
        {var BAR = Bars.ClosePrices[index];
        // The math here works for AUDUSD but changing zeros...here..V.....and....V......
        //   will scale it to other charts                     (BAR*100+BAR)*BAR/10)+BAR)
         Macd[index] = macdCrossOver.MACD[index]*((BAR*100+BAR)*BAR/10)+BAR;
         Signal[index] = macdCrossOver.Signal[index]*((BAR*100+BAR)*BAR/10)+BAR;
         {

         }

        }
    }
}

VE
VEI5S6C4OUNT0

Joined on 06.12.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: MACD ON CHART.algo
  • Rating: 5
  • Installs: 490
Comments
Log in to add a comment.
No comments found.