MACD_RSI free

by gorin in category Oscilator at 31/10/2013
Description

This indicator is a combination of the MACD Crossover and the Relative Strength Index.
The MACD is scaled up so that the two indicators overlap.

98619 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
// -------------------------------------------------------------------------------
//
//    This is a Template used as a guideline to build your own Indicator. 
//
// -------------------------------------------------------------------------------

using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, ScalePrecision = 5, AccessRights = AccessRights.None)]
    public class MACD_RSI : Indicator
    {
        private MacdCrossOver macdCrossOver;
        private RelativeStrengthIndex rsi;


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

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

        [Parameter(DefaultValue = 12)]
        public int shortCycle { get; set; }

        [Parameter(DefaultValue = 26)]
        public int longCycle { get; set; }


        [Output("MACD", Color = Colors.Blue)]
        public IndicatorDataSeries MACD { get; set; }

        [Output("MACD_Signal", Color = Colors.Red)]
        public IndicatorDataSeries MACD_Signal { get; set; }

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

        [Output("RSI")]
        public IndicatorDataSeries RSI { get; set; }


        protected override void Initialize()
        {
            // Initialize and create nested indicators
            macdCrossOver = Indicators.MacdCrossOver(source, longCycle, shortCycle, Periods);
            rsi = Indicators.RelativeStrengthIndex(source, Periods);
        }


        public override void Calculate(int index)
        {
            const int factor = 100000;
            MACD[index] = macdCrossOver.MACD[index] * factor;
            MACD_Histogram[index] = macdCrossOver.Histogram[index] * factor;
            MACD_Signal[index] = macdCrossOver.Signal[index] * factor;
            RSI[index] = rsi.Result[index];
        }
    }
}
Comments