Syntax
public static VHF Series(DataSeries source, int period)
public VHF(DataSeries source, int period, string description)
Parameter Description
source |
Price series |
period |
Indicator calculation period |
Description
The Vertical Horizontal Filter was introduced by Adam White in 1991 and is used to determine if prices are trending or are in a congestion stage. It is calculated by dividing the difference in the sums of highest and lowest values by the sum of the absolute values of daily price differences. Typically a period of 28 is used for VHF.
Interpretation
VHF describes how strongly prices are trending. The higher the VHF value, the stronger the trend.
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()
{
// Color chart background when prices are trending according to VHF
DataSeries vhf = VHF.Series( Close, 28 );
ChartPane VHFPane = CreatePane( 30, true, true );
PlotSeries( VHFPane, vhf, Color.Red, WealthLab.LineStyle.Solid, 1 );
for(int bar = 28; bar < Bars.Count; bar++)
{
if( vhfbar > 0.4 )
SetBackgroundColor( bar, Color.FromArgb(50,0,100,255) );
}
}
}
}