WEALTH-LAB: SEPTEMBER 2012
- Details
- Parent Category: Departments
- Category: Traders' Tips
- Written by Wealth-Lab team

This Traders’ Tip is based on “Developing A Multilevel Strategy” by Vladimir Vladimirovich Voznjuk in this issue.
In his article, Voznjuk shows how a simple currency pair-trading technique can be applied on any intraday time frame. The indicator, however, does not come with universal or fixed thresholds. It’s up to the trader to find the optimal thresholds on a by-currency basis after optimization. (See Figure 1.)

FIGURE 1: WEALTH-LAB. This 60-minute GBPUSD chart illustrates the application of the multiGBP indicator and the adaptive thresholds.
To overcome this, you can use this simple technique (or a similar one): apply a Bollinger Band with a sufficiently long-term period to the multilevel indicator. For example, a 100-period BB with two standard deviations might work well. In addition, these boundaries adjust to the volatility of the instruments and can save you from frequent reoptimization.
As the multilevel indicators depend on the name of the currencies, we’re not including them in the TASCIndicators library. Instead, we’re providing this sample C# strategy code to serve as a guideline for building it yourself — which is an easy task due to the low complexity of the formula.
C# Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class MultiLevel : WealthScript
{
private StrategyParameter paramStop;
private StrategyParameter paramTake;
public MultiLevel()
{
paramStop = CreateParameter("Stop, pips", 20, 5, 50, 5);
paramTake = CreateParameter("Profit, pips", 30, 5, 100, 5);
}
protected override void Execute()
{
try
{
Bars bEur = GetExternalSymbol( "Eur/Usd", true );
Bars bGbp = GetExternalSymbol( "Gbp/Usd", true );
DataSeries multiGBP =
(bEur.Close-bEur.Open) + (bGbp.Close+bGbp.Open) / 10000;
multiGBP.Description = "multiGBP";
BBandLower bbl = BBandLower.Series( multiGBP, 100, 2.0 );
BBandUpper bbu = BBandUpper.Series( multiGBP, 100, 2.0 );
bbl.Description = "Adaptive Lower Threshold";
bbu.Description = "Adaptive Higher Threshold";
ChartPane cp = CreatePane( 50,true,true );
PlotSeries( cp, multiGBP, Color.Blue, LineStyle.Solid, 1 );
PlotSeriesFillBand( cp, bbu, bbl, Color.Red,
Color.Transparent, LineStyle.Solid, 1 );
DrawHorzLine( cp, 0, Color.Blue, LineStyle.Solid, 1 );
HideVolume();
double SL = paramStop.Value / 10000d;
double PT = paramTake.Value / 10000d;
for(int bar = GetTradingLoopStartBar( 100 );
bar < Bars.Count; bar++)
{
if (IsLastPositionActive)
{
Position p = LastPosition;
double Stop =
p.PositionType == PositionType.Long ? p.EntryPrice - SL : p.EntryPrice + SL;
double Target =
p.PositionType == PositionType.Long ? p.EntryPrice + PT : p.EntryPrice - PT;
if( !ExitAtStop(bar + 1, p, Stop, "SL") )
ExitAtLimit(bar + 1, p, Target, "TP");
}
else
{
if( CrossOver( bar, multiGBP, bbl ) )
BuyAtMarket( bar+1 );
else
if( CrossUnder( bar, multiGBP, bbu ) )
ShortAtMarket( bar+1 );
}
}
}
catch( Exception e )
{
PrintDebug( e.Message );
Abort();
}
}
}
}


Join us on Facebook
Follow us on Twitter