Category Other  Published on 15/02/2023

RSI and Stochastic Cloud

Description

This is another basic cloud code to save space on your charts

Its nice to look at.

 

 

 


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 = "AA00AA00", SecondColor = "AAAA0000")]
      
     [Cloud ( "SCH", "SCH50", Opacity = 0.6 , FirstColor = "AA00AA00", SecondColor = "AAAA0000")]
      
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class RSISCH : Indicator
    
    {    // EMA FFAA4400   SMA  FF88AA44 50 AA7733AA P 88554488//
    
    
        public DataSeries Source { get; set; }
   
        [Parameter("RSI Period", DefaultValue = 14)]
        public int RPeriod { get; set; } 
      
        
        [Output("RSI50", LineColor = "FF554488")]
        public IndicatorDataSeries RSI50 { get; set; }
        
        [Output("RSI", LineColor = "000000AA")]
        public IndicatorDataSeries RSI { get; set; }
        
        [Output("RSIP", LineColor = "000000AA",Thickness =1, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries RSIP {get;set;}
   
        [Parameter("K%", DefaultValue = 14)]
        public int KPeriod { get; set; } 
        
        [Parameter("Slowing", DefaultValue = 3)]
        public int KSlowing { get; set; }
    
        [Parameter("D%", DefaultValue = 3)]
        public int DPeriod { get; set; }   
      
        [Output("SCH", LineColor = "000000AA", PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries SCH { get; set; }
        [Output("SCH50", LineColor = "000000AA", PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries SCH50 { get; set; }
        
        [Output("SCHP", LineColor = "000000AA", PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries SCHP {get;set;}
        
        
        [Parameter("maType")]
        public MovingAverageType MAType { get; set; }
        
        
        
        
        private RelativeStrengthIndex rsi;
        private StochasticOscillator sch;
      

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

        public override void Calculate(int index)
        {
         RSI[index] = rsi.Result[index];
         RSIP[index] = RSI.Last(1);
         RSI50[index] = (rsi.Result[index] + 50)-rsi.Result[index];
        
         SCH[index] = sch.PercentK[index];
         
         SCHP[index] = SCH.Last(1);
         SCH50[index] = (sch.PercentK[index] + 50) -sch.PercentK[index];
        
        }
    }
}

VE
VEI5S6C4OUNT0

Joined on 06.12.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: RSI STOCHASTIC CLOUD.algo
  • Rating: 0
  • Installs: 736
  • Modified: 15/02/2023 09:32
Comments
Log in to add a comment.
No comments found.