Description
VKW Bands is a variation of
VK Bands that uses a weighted moving average calculation.
Rules:
Enter long on the next open when the market closes below the lower band.
Exit on the next open when the market closes above the upper band.
Code
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Indicators;
namespace WealthLab.Strategies
{
public class VKWBandsSystem : WealthScript
{
protected override void Execute()
{
VK_WH_Band VK_WH1 = VK_WH_Band.Series( High,10,10 );
PlotSeries( PricePane, VK_WH1, Color.DarkBlue, LineStyle.Solid, 2 );
VK_WL_Band VK_WL1 = VK_WL_Band.Series( Low,10,10 );
PlotSeries( PricePane, VK_WL1, Color.DarkBlue, LineStyle.Solid, 2 );
VK_SH_Band VK_SH1 = VK_SH_Band.Series( High,10,10 );
PlotSeries( PricePane, VK_SH1, Color.LightBlue, LineStyle.Solid, 2 );
for(int bar = 20; bar < Bars.Count; bar++)
{
if (!IsLastPositionActive)
{
if( Close[bar] < VK_WL1[bar] )
BuyAtMarket( bar + 1 );
}
else
{
if( Close[bar] > VK_WH1[bar] )
SellAtMarket( bar + 1, LastPosition );
}
}
}
}
}