Traders' Tip text
We've added Sylvain Vervoort's 
SVAPO indicator to the Wealth-Lab TASCIndicators library for easy reference in any strategy. Since Vervoot promises to discuss the use of 
SVAPO in a trading strategy with price targets in a follow-up article, for now we'll simply provide an example of WealthScript C# code that accesses the 
SVAPO indicator, which we use to calculate the upper and lower standard deviation bands per the article (Figure 1). 
Figure 1: 
SVAPO's "buy" signal for BA in March 2004 was timely indeed to catch the beginning of a significant move higher.
Strategy:using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using TASCIndicators;
namespace WealthLab.Strategies
{
	public class TASC200711 : WealthScript
	{
		private StrategyParameter paramPeriod;
		private StrategyParameter paramCutoff;
		public TASC200711()
		{
			paramPeriod = CreateParameter("Period", 8, 1, 100, 1);
			paramCutoff = CreateParameter("Cutoff", 1, 0.1, 10, 0.1);      
		}
		
		protected override void Execute()
		{
			int period = paramPeriod.ValueInt;
			double cutoff = paramCutoff.Value;
			double devH = 1.5;
			double devL = 1.3;
			int sdPeriod = 100;
			
			var svapo = SVAPO.Series( Bars, period, cutoff );
			var sdUpper = StdDev.Series( svapo, sdPeriod, StdDevCalculation.Sample ) * devH;
			var sdLower = StdDev.Series( svapo, sdPeriod, StdDevCalculation.Sample ) * -devL;
			sdUpper.Description = "SVAPO Upper Band";
			sdLower.Description = "SVAPO Lower Band";
			HideVolume();
			var SvapoPane = CreatePane( 35, false, false );
			PlotSeries( SvapoPane, svapo, Color.Blue, LineStyle.Solid, 2 );
			PlotSeriesFillBand(SvapoPane, sdUpper, sdLower, Color.Silver, Color.Transparent, LineStyle.Dotted, 2);
			DrawHorzLine( SvapoPane, 0, Color.Gray, LineStyle.Dotted, 2 );	
			
			for(int bar = GetTradingLoopStartBar(1); bar < Bars.Count; bar++)
			{
				if (IsLastPositionActive)
				{
					Position p = LastPosition;    
					if ( CrossUnder( bar, svapo, sdUpper ) )
						SellAtMarket( bar+1, p );    
				}
				else
				{
					if ( CrossOver( bar, svapo, sdLower ) )
						BuyAtMarket( bar+1 );
				}
			}
		}
	}
}Robert Sucher
Re-created in C# by Eugene
Wealth-Lab team
www.wealth-lab.com