Category Oscilators  Published on 09/12/2019

Stochastic RSI CCI: c3in1_St_RSI_CCI

Description

The indicator is a combination of Stochastic RSI CCI.

 

 


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class c3in1_St_RSI_CCI : Indicator
    {

        #region #region [Parameter]
        [Parameter("weight_cci", DefaultValue = 0.1)]
        public double weight_cci_parameter { get; set; }

        [Parameter("weight_rsi", DefaultValue = 0.1)]
        public double weight_rsi_parameter { get; set; }

        [Parameter("CCI", DefaultValue = 21)]
        public int CCI_parameter { get; set; }

        [Parameter("RSI", DefaultValue = 21)]
        public int RSI_parameter { get; set; }

        [Parameter("St_K", DefaultValue = 24)]
        public int St_K_parameter { get; set; }

        [Parameter("St_S", DefaultValue = 10)]
        public int St_S_parameter { get; set; }

        [Parameter("FastMA", DefaultValue = 3)]
        public int FastMA_parameter { get; set; }

        [Parameter("SlowMA", DefaultValue = 7)]
        public int SlowMA_parameter { get; set; }
        #endregion #region [Parameter]

        #region #region [Output]
        [Output("SumBuffer", LineColor = "Red")]
        public IndicatorDataSeries SumResult { get; set; }

        [Output("FastMABuffer", LineColor = "Green")]
        public IndicatorDataSeries FastMAResult { get; set; }

        [Output("SlowMABuffer", LineColor = "Brown")]
        public IndicatorDataSeries SlowMAResult { get; set; }
        #endregion #region [Output]

        RelativeStrengthIndex rsi;
        CommodityChannelIndex cci;
        StochasticOscillator st;

        SimpleMovingAverage maFast, maSlow;

        protected override void Initialize()
        {
            rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, RSI_parameter);
            cci = Indicators.CommodityChannelIndex(CCI_parameter);
            st = Indicators.StochasticOscillator(St_K_parameter, St_S_parameter, 3, MovingAverageType.Simple);

            maFast = Indicators.SimpleMovingAverage(SumResult, FastMA_parameter);
            maSlow = Indicators.SimpleMovingAverage(SumResult, SlowMA_parameter);
        }

        public override void Calculate(int index)
        {
            double dRSI = rsi.Result[index] - 50;
            double dCCI = cci.Result[index];
            double dSt = st.PercentK[index] - 50;

            SumResult[index] = dSt * (1 - weight_cci_parameter - weight_rsi_parameter) + dRSI * weight_rsi_parameter + dCCI * weight_cci_parameter;
            FastMAResult[index] = maFast.Result[index];
            SlowMAResult[index] = maSlow.Result[index];

        }
    }
}


VI
Vitali Gajdabrus

Joined on 20.08.2015

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