Category Oscilators  Published on 10/04/2023

Sylvain Vervoort RSI InverseFisherTrans

Description

Indicator Sylvain Vervoort RSI inverse fisher transform built on Sylvain Vervoort Rainbow Moving Average.

Use indicator values when are above the upper limit for long trade, and below the lower limit as short trade zone.


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

namespace cAlgo
{
    [Levels(12.0,50.0,88.0)]
    [Indicator(IsOverlay = false, AccessRights = AccessRights.None, AutoRescale = true)]
    public class mSylvainVervoortRSIinversefishertransform : Indicator
    {
        [Parameter("Period SVRMA (2)", DefaultValue = 2)]
        public int inpPeriodSVRMA { get; set; }
        [Parameter("Period RSI (4)", DefaultValue = 4)]
        public int inpPeriodRSI { get; set; }
        [Parameter("Period SVRMA (4)", DefaultValue = 4)]
        public int inpPeriodMA { get; set; }

        [Output("Sylvain Vervoort RSI InverseFisherTransform", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outsvRSI { get; set; }
        
        private MovingAverage _sma, _sm2, _sm3, _sm4, _sm5, _sm6, _sm7, _sm8, _sm9, _sm10, _sme1, _sme2;
        private IndicatorDataSeries _norm, _rma, _rawrsi, _emazl, _svrsi;
        private RelativeStrengthIndex _rsi;
        

        protected override void Initialize()
        {
            _sma = Indicators.MovingAverage(Bars.ClosePrices, inpPeriodSVRMA, MovingAverageType.Simple);
            _sm2 = Indicators.MovingAverage(_sma.Result, inpPeriodSVRMA, MovingAverageType.Weighted);
            _sm3 = Indicators.MovingAverage(_sm2.Result, inpPeriodSVRMA, MovingAverageType.Weighted);
            _sm4 = Indicators.MovingAverage(_sm3.Result, inpPeriodSVRMA, MovingAverageType.Weighted);
            _sm5 = Indicators.MovingAverage(_sm4.Result, inpPeriodSVRMA, MovingAverageType.Weighted);
            _sm6 = Indicators.MovingAverage(_sm5.Result, inpPeriodSVRMA, MovingAverageType.Weighted);
            _sm7 = Indicators.MovingAverage(_sm6.Result, inpPeriodSVRMA, MovingAverageType.Weighted);
            _sm8 = Indicators.MovingAverage(_sm7.Result, inpPeriodSVRMA, MovingAverageType.Weighted);
            _sm9 = Indicators.MovingAverage(_sm8.Result, inpPeriodSVRMA, MovingAverageType.Weighted);
            _sm10 = Indicators.MovingAverage(_sm9.Result, inpPeriodSVRMA, MovingAverageType.Weighted);
            _norm = CreateDataSeries();
            _rma = CreateDataSeries();
            _rsi = Indicators.RelativeStrengthIndex(_rma, inpPeriodRSI);
            _rawrsi = CreateDataSeries();
            _sme1 = Indicators.MovingAverage(_rawrsi, inpPeriodMA, MovingAverageType.Exponential);
            _sme2 = Indicators.MovingAverage(_sme1.Result, inpPeriodMA, MovingAverageType.Exponential);
            _emazl = CreateDataSeries();
            _svrsi = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            _norm[i] = 5 * _sma.Result[i] + 4 * _sm2.Result[i] + 3 * _sm3.Result[i] + 2 * _sm4.Result[i] + _sm5.Result[i] + _sm6.Result[i] + _sm7.Result[i] + _sm8.Result[i] + _sm9.Result[i] + _sm10.Result[i];
            _rma[i] = _norm[i] / 20.0;
            _rawrsi[i]= 0.1 * (_rsi.Result[i] - 50.0);
            _emazl[i] = _sme1.Result[i] + (_sme1.Result[i] - _sme2.Result[i]);
            _svrsi[i] = ((Math.Pow(2.71828183, 2 * _emazl[i]) - 1.0) / (Math.Pow(2.71828183, 2 * _emazl[i]) + 1.0) + 1.0) * 50.0;
            
            outsvRSI[i] = _svrsi[i];
        }
    }
}


mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mSylvainVervoortRSIinversefishertransform.algo
  • Rating: 5
  • Installs: 671
  • Modified: 10/04/2023 18:38
Comments
Log in to add a comment.
No comments found.