MACD Plus (Free, No Trial)

by D D in category Oscilator at 30/10/2018
Description

Simple MACD indicator shows difference between MACD Histogram and Signal.

Download
74 downloads
How to install
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.Indicators;
using cAlgo.Indicators;

namespace cAlgo.Indicators
{
    //[Levels(0.0)]
    [Indicator(IsOverlay = false, ScalePrecision = 5, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class MACDPlus : Indicator
    {
        // 17 8 9
        // 12 26 9
        // 16 97 2
        // 24, 52, 9
        // 5-34-21

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

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

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

        [Parameter("Reverse", DefaultValue = false)]
        public bool Reverse { get; set; }

        [Output("Main", PlotType = PlotType.Histogram, Color = Colors.DeepSkyBlue)]
        public IndicatorDataSeries Result { get; set; }

        MacdHistogram MACD;

        protected override void Initialize()
        {
            MACD = Indicators.MacdHistogram(Short_Cycle, Long_Cycle, Signal_Period);
            Print("MACD Plus is initialized.    Rezults = {0}", Result.Count);
        }

        public override void Calculate(int index)
        {
            Result[index] = Reverse ? MACD.Histogram[index] - MACD.Signal[index] : MACD.Signal[index] - MACD.Histogram[index];
        }
    }
}
Comments
0