Category Oscilators  Published on 11/08/2024

RSI Cloud

Description

RSI indicator with ichimuko cloud


using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
    [Cloud("RSISSA", "RSISSB", Opacity = 0.2)]
       [Levels(20,50, 80)]
    public class RSI_Cloud : Indicator
    {
        /////////////////////////////////////////////////////// PARAMETERS 
        [Parameter("Period", Group = "RSI", DefaultValue = 14)]
        public int rsiPeriod { get; set; }
        [Parameter("Source")]
        public DataSeries Source { get; set; }
        [Parameter("Show", Group = "cloud of RSI", DefaultValue = true)]
        public bool CSHOW { get; set; }  
        [Parameter("Tenkan sen", Group = "cloud of RSI", DefaultValue = 9)]
        public int TRSI { get; set; }
        [Parameter("Kijun sen", Group = "cloud of RSI", DefaultValue = 26)]
        public int KRSI { get; set; }
        [Parameter("Senkou span b", Group = "cloud of RSI", DefaultValue = 52)]
        public int SSBRSI { get; set; }
        ///////////////////////////////////////////////////////  
        private RelativeStrengthIndex _rsi;
        /////////////////////////////////////////////////////// LEVELS  
        [Output("RSITenken", LineStyle = LineStyle.Solid, LineColor = "blue")]
        public IndicatorDataSeries TI_Result { get; set; }
        [Output("RSIKijun", LineStyle = LineStyle.Solid, LineColor = "red")]
        public IndicatorDataSeries KI_Result { get; set; }
        [Output("RSISSA", LineStyle = LineStyle.Solid, LineColor = "green")]
        public IndicatorDataSeries SSA_Result { get; set; }
        [Output("RSISSB", LineStyle = LineStyle.Solid, LineColor = "maroon")]
        public IndicatorDataSeries SSB_Result { get; set; }
        [Output("RSIChikouspan", LineStyle = LineStyle.Solid, LineColor = "#3999DF22")]
        public IndicatorDataSeries C_Result { get; set; }
        /////////////////////////////////////////////////////// OUTPUTS 
        [Output("RSI", LineColor = "White", PlotType = PlotType.Line, Thickness = 2)]
        public IndicatorDataSeries RSIResult { get; set; }
        /////////////////////////////////////////////////////// INITIALIZE 
        protected override void Initialize()
        {
            _rsi = Indicators.RelativeStrengthIndex(Source, rsiPeriod);      
        }
        /////////////////////////////////////////////////////// CALCULATE 
        public override void Calculate(int index)
        {
            RSIResult[index] = _rsi.Result[index];
            if(CSHOW){
            var vmax=RSIResult[index];
            var vmin=RSIResult[index];
            vmax=Functions.Maximum(RSIResult,KRSI);
            vmin=Functions.Minimum(RSIResult,KRSI);
            KI_Result[index]=(vmin+vmax)/2;
            vmax=Functions.Maximum(RSIResult,TRSI);
            vmin=Functions.Minimum(RSIResult,TRSI);
            TI_Result[index]=(vmin+vmax)/2;
            SSA_Result[index+KRSI]=(TI_Result[index]+KI_Result[index])/2;
            vmax=Functions.Maximum(RSIResult,SSBRSI);
            vmin=Functions.Minimum(RSIResult,SSBRSI);
            SSB_Result[index+KRSI]=(vmin+vmax)/2;
             C_Result[index-KRSI]=RSIResult[index];
            }
        }
    }
}


mr.ch1371's avatar
mr.ch1371

Joined on 11.08.2024

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: RSI_Cloud.algo
  • Rating: 5
  • Installs: 280
  • Modified: 17/08/2024 12:27
Comments
Log in to add a comment.
No comments found.