Syntax
public RVI(Bars bars, int period, string description)
public static RVI Series(Bars bars, int period)
Parameter Description
bars |
The Bars object |
period |
Indicator calculation period |
Description
RVI returns the Relative Vigor Index, and indicator created by John Ehlers of
Mesa Software). RVI measures the average difference between closing and opening price, normalized to the average daily trading range. It applies a normalization filter to smooth the index with minimal lag.
Interpretation
RVI reaches extreme high and low levels near the peaks of uptrends and downtrends. You can trigger signals based on these extreme levels, or wait until RVI crosses above or below a signal line.
The RVI indicator accepts a parameter that determines the Period to use in its calculation. You can create a dynamic RVI that is based on half of the dominant cycle period as described by Ehlers. Below we create a custom Price Series and populate with the RVI values based on half of the cycle period as determined by the HTPeriod indicator.
Example
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
DataSeries rvi = RVI.Series( Bars, 10 );
ChartPane RVIPane = CreatePane( 50, true, true );
PlotSeries( RVIPane, rvi, Color.DarkBlue, LineStyle.Solid, 1 );
for(int bar = rvi.FirstValidValue; bar < Bars.Count; bar++)
{
for(int p = ActivePositions.Count - 1; p >= 0; p--)
{
Position pos = ActivePositionsp;
if( CrossOver( bar, rvi, 0.35 ) )
SellAtMarket( bar+1, pos );
}
if( ( TurnUp( bar, rvi ) ) & ( rvibar-1 < -0.35 ) )
BuyAtMarket( bar+1 );
}
}
}
}