Stochastic & RSI free

by irmrdeveloper in category Oscilator at 24/12/2022
Description

For better results, please add levels 20 and 80 to the indicator area

when RSI touch or cross 20 or 80 levels and Stochastic is in overbought by create divergence in RSI or both we can trade in opposite direction

Good luck

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
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(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class StochRSI : Indicator
    {
   
        [Parameter("K%", DefaultValue = 9)]
        public int KPeriod { get; set; } 
        
        [Parameter("Slowing", DefaultValue = 4)]
        public int KSlowing { get; set; }
    
        [Parameter("D%", DefaultValue = 7)]
        public int DPeriod { get; set; }   
        
        [Parameter("maType")]
        public MovingAverageType MAType { get; set; }
        
        [Parameter("RP", DefaultValue = 9)]
        public int RPeriod { get; set; } 
        
        [Parameter()]
        public DataSeries Source { get; set; }
      
        private StochasticOscillator stoch;
        private RelativeStrengthIndex rsi;
      
        [Output("Stochastic", LineColor = "FF760052")]
        public IndicatorDataSeries Stochastic { get; set; }
        
         [Output("RSI", LineColor = "FF115976")]
        public IndicatorDataSeries RSI { get; set; }
      

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

        public override void Calculate(int index)
        {
          
         Stochastic[index] = stoch.PercentK[index];
         RSI[index] = rsi.Result[index];
        
        }
    }
}
Comments

VEI5S6C4OUNT0 - January 19, 2023 @ 15:20

This is great I like it.

I wonder if can we add the D line and also a MACD crossover lines or cloud to it as well ?

0