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
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];
}
}
}
IR
irmrdeveloper
Joined on 03.10.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Stoch & RSI.algo
- Rating: 0
- Installs: 1919
- Modified: 24/12/2022 10:51
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
VE
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 ?
This is the best website I've brought a lot of useful
information that you can see at a glance!!
토토프레이