category Oscilator  at 18/05/2023



In this indicator, I have tried to combine two indicators Stochastic and Rsi in the simplest way.
This is not the best way, but it works.
For years, CTrader users have been asking the creators of this software to add this feature, but I don't know where the problem is and why they don't do it!

combine rsi and stochastic in Ctrader


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

    [Indicator(AccessRights = AccessRights.None)]
    public class RsiStoch : Indicator
        [Parameter("Enable Stoch", Group = "Setting", DefaultValue = true)]
        public bool Show_Stoch { get; set; }

        [Parameter("K Periods", DefaultValue = 9, Group = "Stoch")]
        public int kPeriods { get; set; }

        [Parameter("K Slowing", DefaultValue = 3, Group = "Stoch")]
        public int kSlowing { get; set; }

        [Parameter("D Periods", DefaultValue = 3, Group = "Stoch")]
        public int dPeriods { get; set; }

        [Parameter("MA Type", DefaultValue = MovingAverageType.Simple, Group = "Stoch")]
        public MovingAverageType maType { get; set; }

        [Parameter("Enable Rsi", Group = "Setting", DefaultValue = true)]
        public bool Show_Rsi { get; set; }
        [Parameter("Period", DefaultValue = 14, Group = "Rsi")]
        public int Rsi_Period { get; set; }

        public StochasticOscillator Stoch;
        public RelativeStrengthIndex Rsi;

        [Output("%K", LineColor = "Yellow")]
        public IndicatorDataSeries Stoch_Kline { get; set; }

        [Output("%D", LineColor = "Red")]
        public IndicatorDataSeries Stoch_Dline { get; set; }

        [Output("Rsi", LineColor = "Blue")]
        public IndicatorDataSeries Rsi_line { get; set; }

        protected override void Initialize()
            if (Show_Stoch)
                Stoch = Indicators.StochasticOscillator(kPeriods, kSlowing, dPeriods, maType);
            if (Show_Rsi)
                Rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, Rsi_Period);


        public override void Calculate(int index)
            if (Show_Stoch)
                Stoch_Kline[index] = Stoch.PercentK.Last(0);
                Stoch_Dline[index] = Stoch.PercentD.Last(0);
            if (Show_Rsi)
                Rsi_line[index] = Rsi.Result.Last(0);

meeting.chegini's avatar

Joined 16.01.2022

  • Type: free
  • Language: C#
  • Trading Platform: cTrader Automate
  • Filename: RsiStoch.algo
  • Rating: 5
  • Downloads: 369
Only logged in users can post a comment
meeting.chegini's avatar
meneto · 3 months ago

I also tried to properly integrate Macd with these two indicators, but I did not get any results

Splash The · 3 months ago

I have a similar indicator that shoes as clouds and or lines , it also has MACD but the output is set to "signal +50" to line up with RSI and Stochastic 50 but the scale needs to be set to each chart as needed.

Maybe you have some ideas to make this part automatic ?