Category Oscilators  Published on 03/07/2023

Relative Vigor Index indicator

Description

The Relative Vigor Index (RVI) is a momentum indicator used in technical analysis that measures the strength of a trend by comparing a security's closing price to its trading range while smoothing the results. Therefore, the idea behind the RVI is that the vigor or energy of the price movement is determined by where the prices end up at the close.

The RVI's usefulness is based on the observed tendency for prices to close higher than they open during uptrends, and to close lower than they open in downtrends.

Here's how the indicator results can be interpreted:

  1. When the RVI component crosses above the Signal component, and the RVI is above zero, it suggests a "Lower High" price scenario. This means that the price is expected to make a high point that is lower than the previous high.

  2. When the Signal component crosses above the RVI component, and the RVI is above zero, it suggests a "Higher High" price scenario. This means that the price is expected to make a high point that is higher than the previous high.

  3. When the RVI component crosses below the Signal component, and the RVI is below zero, it suggests a "Lower High" price scenario. This means that the price is expected to make a high point that is lower than the previous high.

  4. When the Signal component crosses below the RVI component, and the RVI is below zero, it suggests a "Lower Low" price scenario. This means that the price is expected to make a low point that is lower than the previous low.

It's important to note that these interpretations are based on the general rules provided by the RVI and Signal components of the indicator. 


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

namespace cAlgo.Indicators
{
    [Levels(-0.2, 0, +0.2)]
    [Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
    public class mRVI : Indicator
    {
        [Parameter("RVI Period (10)", DefaultValue = 10)]
        public int inpPeriod { get; set; }

        [Output("RVI", LineColor = "Black")]
        public IndicatorDataSeries outRVIMain { get; set; }
        [Output("Signal", LineColor = "Red")]
        public IndicatorDataSeries outRVISignal { get; set; }

        private IndicatorDataSeries _openclose, _highlow, _rvi, _signal;


        protected override void Initialize()
        {
            _openclose = CreateDataSeries();
            _highlow = CreateDataSeries();
            _rvi = CreateDataSeries();
            _signal = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            _openclose[i] = ((Bars.ClosePrices[i] - Bars.OpenPrices[i]) + 2 * (Bars.ClosePrices[i-1] - Bars.OpenPrices[i-1]) + 2 * (Bars.ClosePrices[i-2] - Bars.OpenPrices[i-2]) + (Bars.ClosePrices[i-3] - Bars.OpenPrices[i-3])) / 6;
            _highlow[i] = ((Bars.HighPrices[i] - Bars.LowPrices[i]) + 2 * (Bars.HighPrices[i-1] - Bars.LowPrices[i-1]) + 2 * (Bars.HighPrices[i-2] - Bars.LowPrices[i-2]) + (Bars.HighPrices[i-3] - Bars.LowPrices[i-3])) / 6;
            _rvi[i] = _openclose.Sum(inpPeriod) / _highlow.Sum(inpPeriod);
            _signal[i] = (_rvi[i] + 2 * _rvi[i-1] + 2 * _rvi[i-2] + _rvi[i-3]) / 6;

            outRVIMain[i] = _rvi[i];
            outRVISignal[i] = _signal[i];
        }
    }
}

mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mRVI.algo
  • Rating: 5
  • Installs: 706
Comments
Log in to add a comment.
diogofmor's avatar
diogofmor · 3 days ago

PT-BR
Este é um bom indicador. Uso ele no Metatrader 5 e agora uso no cTrader também. Parabéns pela iniciativa de construir esse RVI que funciona muito bem com o MACD.
EN
This is a good indicator. I use it in Metatrader 5 and now I use it in cTrader too. Congratulations on the initiative to build this RVI that works very well with MACD.