Category Other  Published on 15/02/2023

RSI MACD Lines

Description

This one is like the others, only not a cloud if you would rather ...

Also the bar colours I use make it easier to not get messed up with the trade ... let it ride .

 

 


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
{

     [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class RSIMACD : 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; }

        [Parameter("MACD Adjuster   Adjust this for different charts and time frames \n eg EUR 5m set to 40000, and XAU 5m set to 10 \n hint add 0's to find MACD \n Also untik all the boxs for better viewing ", DefaultValue = 4)]
        public int Factor { get; set; }

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

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

        [Parameter("RP", DefaultValue = 14)]
        public int RPeriod { get; set; } 

        [Output("RSI70", LineColor = "FF33C1F3")]
        public IndicatorDataSeries RSI70 { get; set; }

        [Output("RSI50", LineColor = "AA554488")]
        public IndicatorDataSeries RSI50 { get; set; }

        [Output("RSI30", LineColor = "FF33C1F3")]
        public IndicatorDataSeries RSI30 { get; set; }

        [Output("RSI", LineColor = "AAFFFF00")]
        public IndicatorDataSeries RSI { get; set; }

        private RelativeStrengthIndex rsi;
        private MacdCrossOver macdCrossOver;

        protected override void Initialize()
        {
           rsi = Indicators.RelativeStrengthIndex(Source, RPeriod);

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

        public override void Calculate(int index)
        {
         RSI[index] = rsi.Result[index];
         RSI70[index] = (rsi.Result[index] + 70)-rsi.Result[index];
         RSI50[index] = (rsi.Result[index] + 50)-rsi.Result[index];
         RSI30[index] = (rsi.Result[index] + 30)-rsi.Result[index];
         Macd[index] = macdCrossOver.MACD[index]*Factor+50;
         Signal[index] = macdCrossOver.Signal[index]*Factor+50;
         {

         }

        }
    }
}

VE
VEI5S6C4OUNT0

Joined on 06.12.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: RSI MACD LINES.algo
  • Rating: 0
  • Installs: 622
Comments
Log in to add a comment.
No comments found.