Category Other  Published on 31/05/2023

RSI Stochastic and MACD CLOUD on Chart

Description

This is what 3 clouds look like ON CHART

I know it's a mess but thats what happens ha ha ha

 

 


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 ( "RSI", "RSI50", Opacity = 0.8 , FirstColor = "RSI", SecondColor = "RSI50")]
      
     [Cloud ( "SCH", "SCH50", Opacity = 0.6 , FirstColor = "SCH", SecondColor = "SCH50")]
     
     [Cloud ( "Macd", "Signal", Opacity = 1 , FirstColor = "Macd", SecondColor = "Signal")]
    
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    
    public class RSISCHON : Indicator
    
    {    // EMA FFAA4400   SMA  FF88AA44 50 AA7733AA P 88554488//
    
    
        public DataSeries Source { get; set; }
   
        [Parameter("RSI Period",Group = "These Defaults are for AUDUSD", DefaultValue = 14)]
        public int RPeriod { get; set; }

        
        
        [Output("RSI", LineColor = "4000FF00" )]
        public IndicatorDataSeries RSI { get; set; }
        
        [Output("RSI50", LineColor = "40FF4400" )]
        public IndicatorDataSeries RSI50 { get; set; }
        

        [Parameter("maType",Group = "These Defaults are for AUDUSD")]
        public MovingAverageType MAType { get; set; }
        
        [Parameter("K%",Group = "These Defaults are for AUDUSD", DefaultValue = 14)]
        public int KPeriod { get; set; } 
        
        [Parameter("Slowing",Group = "These Defaults are for AUDUSD", DefaultValue = 3)]
        public int KSlowing { get; set; }
    
        [Parameter("D%",Group = "These Defaults are for AUDUSD", DefaultValue = 3)]
        public int DPeriod { get; set; }
        
      
        [Output("SCH", LineColor = "4000FF00" )]
        public IndicatorDataSeries SCH { get; set; }
        
        [Output("SCH50", LineColor = "40FF4400" )]
        public IndicatorDataSeries SCH50 { get; set; }
        
        
        [Parameter("Long Cycle",Group = "These Defaults are for AUDUSD", DefaultValue = 26)]
        public int LongCycle { get; set; }

        [Parameter("Short Cycle",Group = "These Defaults are for AUDUSD", DefaultValue = 12)]
        public int ShortCycle { get; set; }

        [Parameter("Signal Periods",Group = "These Defaults are for AUDUSD", 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;}

        

        
        
        
        
        [Parameter("Factor 1 Sets RSI and Stochastic to Close Price ",Group = "These Defaults are for AUDUSD", DefaultValue = 25000)]
        public int F1 { get; set; }
        
        [Parameter("Factor 2 Sets RSI and Stochastic to Close Price",Group = "These Defaults are for AUDUSD", DefaultValue = 333)]
        public int F2 { get; set; }
        
        [Parameter("Factor 3 Sets Macd to Close Price",Group = "These Defaults are for AUDUSD", DefaultValue = 100)]
        public int F3 { get; set; }
        
        [Parameter("Factor 4 Sets Macd to Close Price",Group = "These Defaults are for AUDUSD", DefaultValue = 10)]
        public int F4 { get; set; }
        
        
        private RelativeStrengthIndex rsi;
        
        private StochasticOscillator sch;
        
        private MacdCrossOver macdCrossOver;

        protected override void Initialize()
        {
           rsi = Indicators.RelativeStrengthIndex(Source, RPeriod);
            
           sch = Indicators.StochasticOscillator(KPeriod, KSlowing, DPeriod, MAType);
           
           macdCrossOver = Indicators.MacdCrossOver(LongCycle, ShortCycle, Periods);
        }
        

        public override void Calculate(int index)
        {
         var BAR = Bars.ClosePrices[index];
        
         RSI[index] = rsi.Result[index] / F1 + BAR - ( BAR / F2 ) ;
         
         RSI50[index] = Bars.ClosePrices[index];
         
        
         SCH[index] = sch.PercentK[index] / F1 + BAR - ( BAR / F2 ) ;
         
         SCH50[index] = Bars.ClosePrices[index];
         
         
         Macd[index] = macdCrossOver.MACD[index] * (( BAR * F3 + BAR ) * BAR / F4 ) + BAR ;

         Signal[index] = macdCrossOver.Signal[index] * (( BAR * F3 + BAR ) * BAR / F4 ) + BAR ;
        
        }
    }
}

VE
VEI5S6C4OUNT0

Joined on 06.12.2022

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