Syntax
public static Vidya Series(DataSeries source, int stdDevPeriod, double alpha)
public Vidya(DataSeries source, int stdDevPeriod, double alpha, string description)
public Vidya(DataSeries source, DataSeries volatilityIndex, double alpha, string description)
Parameter Description
source |
The source DataSeries |
alpha |
A floating point Alpha parameter |
stdDevPeriod |
StdDev period |
volatilityIndex |
An indicator that tracks market volatility |
Description
Vidya returns Tushar Chande's Variable Index Dynamic Average. Vidya is similar to an Exponential Moving Average,
EMA, but uses a different period for each bar of calculation. The period to use is determined by the bar's volatility. Bars with a high volatility will use a shorter period, and those with a low volatility a longer period. This results in an indicator that is very responsive to abrupt market moves, but becomes less responsive during consolidation periods.
Vidya requires a "Volatility Index", which should be some indicator that tracks market volatility. Specify the Volatility Index as a DataSeries in the
volatilityIndex parameter. The resulting Vidya will have lower effective periods on bars where the Index indicates high volatility.
Vidya also requires a floating point
alpha parameter. The values of the Volatility Index are multiplied by
alpha to modulate the sensitivity of the Vidya. You should arrive at a value of
alpha such that (1 - α * Volatility Index) never becomes negative.
Interpretation
You can interpret Vidya as you would another moving average. Additionally, Vidya tends to respond more quickly and go flat during consolidation periods.
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()
{
// Vidya bands
DataSeries VidyaStdDev = Vidya.Series( Close, 2, 0.1 );
PlotSeries( PricePane, VidyaStdDev, Color.Red, WealthLab.LineStyle.Dashed, 1 );
DrawLabel( PricePane, "Vidya Bands at 3%", Color.Red );
PlotSeriesDualFillBand( PricePane, VidyaStdDev*1.03, VidyaStdDev*0.97, Color.FromArgb(15,255,0,0),
Color.Empty, Color.Empty, LineStyle.Solid, 1 );
}
}
}