Warning! This section will be deprecated on February 1st 2025. Please move all your Indicators to the cTrader Store catalogue.
Description
The Sylvain Vervoort Asymmetrical RSI indicator was described in the October 2008 issue of the 'Stocks & Commodities' magazine.
This indicator is used to determine trade sentiments in correlation with indicator value above and below level 50, in multiple periods, such as 10, 50, 100, and 200.
/
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Levels(30,50,70)]
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
public class mRSIasymmetrical : Indicator
{
[Parameter("Period (10)", DefaultValue = 10, MinValue = 2)]
public int inpPeriod { get; set; }
[Output("RSI Asymmetrical ", LineColor = "Black", PlotType = PlotType.Line, Thickness = 1)]
public IndicatorDataSeries outRSIasymmetrical { get; set; }
private IndicatorDataSeries _delta, _up, _dn, _cnt, _upres, _dnres, _upmove, _dnmove, _rsiasymmetrical;
private MovingAverage _upavg, _dnavg, _cntavg;
protected override void Initialize()
{
_delta = CreateDataSeries();
_up = CreateDataSeries();
_dn = CreateDataSeries();
_cnt = CreateDataSeries();
_upavg = Indicators.MovingAverage(_up, (2*inpPeriod-1), MovingAverageType.Exponential);
_dnavg = Indicators.MovingAverage(_dn, (2*inpPeriod-1), MovingAverageType.Exponential);
_cntavg = Indicators.MovingAverage(_cnt, inpPeriod, MovingAverageType.Simple);
_upres = CreateDataSeries();
_dnres = CreateDataSeries();
_upmove = CreateDataSeries();
_dnmove = CreateDataSeries();
_rsiasymmetrical = CreateDataSeries();
}
public override void Calculate(int i)
{
_delta[i] = i>1 ? Bars.ClosePrices[i] - Bars.ClosePrices[i-1] : Bars.ClosePrices[i] - Bars.TypicalPrices[i];
_up[i] = Math.Max(_delta[i],0);
_dn[i] = Math.Abs(Math.Min(_delta[i],0));
_cnt[i] = _delta[i] < 0 ? 0 : 1;
_upres[i] = Math.Floor(_cntavg.Result[i] * inpPeriod + 0.5);
_dnres[i] = inpPeriod - _up[i];
_upmove[i] = _upres[i] == 0 ? 0 : _upres[i] == 1 ? _up[i] : _upavg.Result[i];
_dnmove[i] = _dnres[i] == 0 ? 0 : _dnres[i] == 1 ? _dn[i] : _dnavg.Result[i];
_rsiasymmetrical[i] = _dnmove[i] == 0 ? 100.0 : (100.0 - 100.0 / (1.0 + _upmove[i] / _dnmove[i]));
outRSIasymmetrical[i] = _rsiasymmetrical[i];
}
}
}
mfejza
Joined on 25.01.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: mRSIasymmetrical.algo
- Rating: 5
- Installs: 641
- Modified: 16/05/2023 10:18
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.
It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks. white label payment processing