Category Oscilators  Published on 17/08/2024

RSI CC

Description

RSI Candle base + Ichimoku

 



////////////////////////////////////////////////////////////////////////////////////////
///                                     RSI CC                                       ///
///                                                                                  ///
///         Publish date  18-DEC-2023                                                ///
///         Version  1.0.0                                                           ///
///         By  mohamadreza chaji                                                    ///
///         License  MIT                                                             ///
///         Contact  mr.ch1371@gmail.com                                             ///
///                                                                                  ///
////////////////////////////////////////////////////////////////////////////////////////

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 RSICC : Indicator
    {
        /////////////////////////////////////////////////////// PARAMETERS 
        [Parameter("Period", Group = "RSI", DefaultValue = 14)]
        public int rsiPeriod { get; set; }
        [Parameter("Candle Width", Group = "RSI", DefaultValue = 5)]
        public int cw { 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 _open_rsi;
        private RelativeStrengthIndex _close_rsi;
        private RelativeStrengthIndex _high_rsi;
        private RelativeStrengthIndex _low_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 
        public IndicatorDataSeries o_RSIResult { get; set; }
        public IndicatorDataSeries c_RSIResult { get; set; }
        public IndicatorDataSeries l_RSIResult { get; set; }
        public IndicatorDataSeries h_RSIResult { get; set; }
        
        /////////////////////////////////////////////////////// INITIALIZE 
        protected override void Initialize()
        {
         o_RSIResult=CreateDataSeries(); 
         c_RSIResult=CreateDataSeries(); 
         l_RSIResult=CreateDataSeries(); 
         h_RSIResult=CreateDataSeries(); 
            _open_rsi = Indicators.RelativeStrengthIndex(this.MarketSeries.Open, rsiPeriod);    
            _close_rsi = Indicators.RelativeStrengthIndex(this.MarketSeries.Close, rsiPeriod);     
            _low_rsi = Indicators.RelativeStrengthIndex(this.MarketSeries.Low, rsiPeriod);     
            _high_rsi = Indicators.RelativeStrengthIndex(this.MarketSeries.High, rsiPeriod);       
        }
        /////////////////////////////////////////////////////// CALCULATE 
        public override void Calculate(int index)
        {
               o_RSIResult[index] = _open_rsi.Result[index];
               c_RSIResult[index] = _close_rsi.Result[index];
               l_RSIResult[index] = _low_rsi.Result[index];
               h_RSIResult[index] = _high_rsi.Result[index];
            var color = o_RSIResult[index] < c_RSIResult[index] ? Colors.Green : Colors.Red;        
            this.ChartObjects.DrawLine(string.Format("wick{0}", index), index, l_RSIResult[index], index, h_RSIResult[index], color, 1, LineStyle.Solid);
            this.ChartObjects.DrawLine(string.Format("candle{0}", index), index, o_RSIResult[index], index, c_RSIResult[index], color, cw, LineStyle.Solid);
            if(CSHOW){
            var vmax=0.0;
            var vmin=0.0;
            vmax=Functions.Maximum(h_RSIResult,KRSI);
            vmin=Functions.Minimum(l_RSIResult,KRSI);
            KI_Result[index]=(vmin+vmax)/2;
            vmax=Functions.Maximum(h_RSIResult,TRSI);
            vmin=Functions.Minimum(l_RSIResult,TRSI);
            TI_Result[index]=(vmin+vmax)/2;
            SSA_Result[index+KRSI]=(TI_Result[index]+KI_Result[index])/2;
            vmax=Functions.Maximum(h_RSIResult,SSBRSI);
            vmin=Functions.Minimum(l_RSIResult,SSBRSI);
            SSB_Result[index+KRSI]=(vmin+vmax)/2;
             C_Result[index-KRSI]=c_RSIResult[index];
            }
        }
    }
}


mr.ch1371's avatar
mr.ch1371

Joined on 11.08.2024

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: RSI CC.algo
  • Rating: 5
  • Installs: 382
  • Modified: 17/08/2024 13:19
Comments
Log in to add a comment.
No comments found.