TASC 2012-09 | Developing a Multi-Level Strategy (Voznjuk)

Modified on 2012/08/07 08:57 by Eugene — Categorized as: TASC Traders Tips

Traders' Tip text

In latest Traders' Tip, author Vladimir Voznjuk shows a simple currency pair-trading technique that can be applied on any intraday timeframe. 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.

Figure 1. The 60-minute GBPUSD chart illustrates the application of the multiGBP indicator and the adaptive thresholds.

  1. Simply drag and drop one of the general conditions on an entry or exit (specifically, “Indicator crosses above/below a Value), and then
  2. Click where indicated to select the SZO from the Indicators dialog.

Image

To overcome this, you can use this simple technique (or a similar one): apply a Bollinger Bands with a sufficiently long-term period to the multi-level indicator. For example, a 100-period BB with 2 standard deviations might work well. In addition, these boundaries adjust to the volatility of the instruments and can save from frequent reoptimization.

As the multi-level 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 low complexity of the formula:



WealthScript Code (C#)


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(); } } } }