Dax survivor long/short mean reverting/breakout

Category: Strategies By: Francesco78 Created: April 29, 2017, 8:36 AM
April 29, 2017, 8:36 AM
Strategies
7 Comments

Dear all

I have tested a slight variation on the them of my previously described strategy on short TF.

This time I took a very long timeseries, used Daily timeframe and modified the exit strategy in term of number of bars, all is optimized with Reiner’s seasonal parameters

Although the return of 180%  with a drawdown of  ~20k on a such a long timeseries is not great, I though it was worth posting because of the ability of this strategy to survive all the 1998/2001/2008 shocks and because it’s relative smoothness.

Any idea to reduce the drawdown even more would be greatly appreciated.

Best Regards

Francesco

// DAX(mini) - IG MARKETS
// TIME FRAME 1Day
// SPREAD 1.0 Point

DEFPARAM CumulateOrders = False

//DEFPARAM FLATBEFORE =090000
//DEFPARAM FLATAFTER =210000
golong = 1
goshort = 1
exitafternbars =1 // the strategy has an exit strategy of the type n bars

// variables optimized
adxvallong = 36 // set the adx value for long position under which the  strategy is mean reverting and above which the strategy is breakout
atrmaxlong = 100//set the max vol accetable for long position
adxvalshort = 24// set the adx value for short poistions under which the strategy is mean reverting and above which the strategy is breakout
atrmaxshort = 200//set the max vol acceptable for short positions

along= 30//number of cons bar for a long trade
mlong = 1// sets the atr multiplier to enter into a mean reverting strategy for long positions
nlong = 1//sets the atr multiplier to enter into a breakout strategy for long positions

ashort=5//number of cons bars for a short trade
mshort = 1//sets the atr multiplier to enter into a mean reverting strategy for short positions
nshort = 2//sets the atr multiplier to enter into a breakout strategy for short positions
//

vollongok = atr<atrmaxlong
volshortok = atr<atrmaxshort
brekoutlong = marketregimeindicator>adxvallong
meanreversionlong = marketregimeindicator <adxvallong
brekoutshort = marketregimeindicator>adxvalshort
meanreversionshort = marketregimeindicator<adxvalshort
adxperiod = 14
atrperiod = 14
marketregimeindicator = adx[adxperiod]
atr = AverageTrueRange[atrperiod]

positionshort = round(1000/atr) //define the size of short positions
positionlong =  saisonalpatternmultiplier*round(1000/atr/2.16666) // define the size of long positions

// define saisonal position multiplier for each month 1-15 / 16-31 (>0 - long / <0 - short / 0 no trade)
ONCE January1 = 3 //0 risk(3)
ONCE January2 = 0 //3 ok
ONCE February1 = 3 //3 ok
ONCE February2 = 3 //0 risk(3)
ONCE March1 = 3 //0 risk(3)
ONCE March2 = 2 //3 ok
ONCE April1 = 3 //3 ok
ONCE April2 = 3 //3 ok
ONCE May1 = 1 //0 risk(1)
ONCE May2 = 1 //0 risk(1)
ONCE June1 = 1 //1 ok 2
ONCE June2 = 2 //3 ok
ONCE July1 = 3 //1 chance
ONCE July2 = 2 //3 ok
ONCE August1 = 2 //1 chance 1
ONCE August2 = 3 //3 ok
ONCE September1 = 3 //0 risk(3)
ONCE September2 = 0 //0 ok
ONCE October1 = 3 //0 risk(3)
ONCE October2 = 2 //3 ok
ONCE November1 = 1 //1 ok
ONCE November2 = 3 //3 ok
ONCE December1 = 3 // 1 chance
ONCE December2 = 2 //3 ok

// set saisonal multiplier
currentDayOfTheMonth = Day
midOfMonth = 15
IF CurrentMonth = 1 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = January1
 ELSE
  saisonalPatternMultiplier = January2
 ENDIF
ELSIF CurrentMonth = 2 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = February1
 ELSE
  saisonalPatternMultiplier = February2
 ENDIF
ELSIF CurrentMonth = 3 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = March1
 ELSE
  saisonalPatternMultiplier = March2
 ENDIF
ELSIF CurrentMonth = 4 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = April1
 ELSE
  saisonalPatternMultiplier = April2
 ENDIF
ELSIF CurrentMonth = 5 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = May1
 ELSE
  saisonalPatternMultiplier = May2
 ENDIF
ELSIF CurrentMonth = 6 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = June1
 ELSE
  saisonalPatternMultiplier = June2
 ENDIF
ELSIF CurrentMonth = 7 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = July1
 ELSE
  saisonalPatternMultiplier = July2
 ENDIF
ELSIF CurrentMonth = 8 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = August1
 ELSE
  saisonalPatternMultiplier = August2
 ENDIF
ELSIF CurrentMonth = 9 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = September1
 ELSE
  saisonalPatternMultiplier = September2
 ENDIF
ELSIF CurrentMonth = 10 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = October1
 ELSE
  saisonalPatternMultiplier = October2
 ENDIF
ELSIF CurrentMonth = 11 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = November1
 ELSE
  saisonalPatternMultiplier = November2
 ENDIF
ELSIF CurrentMonth = 12 THEN
 IF currentDayOfTheMonth <= midOfMonth THEN
  saisonalPatternMultiplier = December1
 ELSE
  saisonalPatternMultiplier = December2
 ENDIF

endif

//long meanreversion
IF (abs(open-close) > (atr*mlong) and close < open and golong and vollongok and meanreversionlong)   THEN
 buy  positionlong CONTRACTS AT MARKET
ENDIF

// long breakout
IF (abs(open-close) > (atr*nlong) and close > open and golong and vollongok and brekoutlong)   THEN
 buy  positionlong CONTRACTS AT MARKET
ENDIF

//short meanrevesrion
IF (abs(open-close) > (atr*mshort) and close > open and goshort and volshortok and meanreversionshort)   THEN
 sellshort positionshort CONTRACTS AT MARKET
ENDIF

// short
IF (abs(open-close) > (atr*nshort) and close < open and goshort and volshortok and brekoutshort)   THEN
 sellshort  positionshort CONTRACTS AT MARKET
ENDIF

if exitafternbars then
 IF shortonmarket and BarIndex - TradeIndex >= ashort Then
  exitshort  positionshort contracts at Market
 EndIF
endif

if exitafternbars then
 IF longonmarket and BarIndex - TradeIndex >= along Then
  sell  positionlong contracts at Market
 EndIF
endif

//set target profit p*atr
//set stop ploss l*atr

 

Download
Filename: Dax1Dsurvivor_v2.itf
Downloads: 317
Download
Filename: daxsurvivor_2.png
Downloads: 237
Download
Filename: Dax1DMNandBreak.itf
Downloads: 318
Download
Filename: statdax1d.png
Downloads: 185
Francesco78 Master
I usually let my code do the talking, which explains why my bio is as empty as a newly created file. Bio to be initialized...
Author’s Profile

Comments

Logo Logo
Loading...