Dax adaptable strategy Breakout/Mean reversion

Category: Strategies By: Francesco78 Created: April 22, 2017, 5:30 PM
April 22, 2017, 5:30 PM
Strategies
22 Comments

Dear all

I have elaborated a little over an  idea originally posted in the forum by Bjoern posted as True Range Breakout EUR/USD.

I applied to the Dax with the additional feature of switching from a breakout to a mean reversion strategy depending on some optimized value of the ADX indicator.

The strategy is a breakout strategy when the adx is above a certain value and a mean reverting strategy when ADX value is below that same value.

I have optimized it on several time frame and the results look quite promising, it would be great if someone think of a better way of discriminate between range trading vs trending phases.  I have used the  popular ADX indicator, but I am sure there are more efficient way to look at phase transitions in market.

The results for different time frames are attached, together with the 30minutes code.

Best Regards

Francesco

DEFPARAM CumulateOrders = False
DEFPARAM FLATBEFORE =080000
DEFPARAM FLATAFTER =210000
adxval = 20
ATRperiod = 12
adxperiod = 15
indicator1 = adx[adxperiod]
atr = AverageTrueRange[ATRperiod]

m = 3
n = 2
c1 = indicator1 <adxval
c2 = indicator1 >adxval

if c1 then
 // short
 IF (abs(open-close) > (atr*m) and close > open)   THEN
  sellshort  1 CONTRACTS AT MARKET
  //SET STOP pLOSS losses
  //SET TARGET pPROFIT profits
 ENDIF

 //long
 IF (abs(open-close) > (atr*m) and close < open)   THEN
  buy  1 CONTRACTS AT MARKET
  //SET STOP pLOSS losses
  //SET TARGET pPROFIT profits
 ENDIF
endif

if c2 then
 // long
 IF (abs(open-close) > (atr*n) and close > open and close> Dhigh(1))   THEN
  buy  1 CONTRACTS AT MARKET
  //SET STOP pLOSS losses
  //SET TARGET pPROFIT profits
 ENDIF

 //short
 IF (abs(open-close) > (atr*n) and close < open and close< Dlow(1))   THEN
  sellshort  1 CONTRACTS AT MARKET
  //SET STOP pLOSS losses
  //SET TARGET pPROFIT profits
 ENDIF
endif

 

Download
Filename: comparison.png
Downloads: 238
Download
Filename: dax1hr.png
Downloads: 196
Download
Filename: Dax1hrMNandBreakv2withseas.png
Downloads: 127
Download
Filename: dax_1hr-1.png
Downloads: 179
Download
Filename: Dax1hrMNandBreakv2.itf
Downloads: 482
Download
Filename: dax_1hr.png
Downloads: 213
Download
Filename: dax_15mins.png
Downloads: 270
Download
Filename: Dax30minMNandBreak.itf
Downloads: 549
Download
Filename: dax_10mins.png
Downloads: 310
Francesco78 Master
As an architect of digital worlds, my own description remains a mystery. Think of me as an undeclared variable, existing somewhere in the code.
Author’s Profile

Comments

Logo Logo
Loading...