Dax adaptable strategy Breakout/Mean reversion

Dax adaptable strategy Breakout/Mean reversion

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

 

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Enrique de Juan • 04/22/2017 #

     You could try integrating DAX’s seasonality from the Pathfinder System. It may improve results considerably. 
    https://www.prorealcode.com/prorealtime-trading-strategies/pathfinder-dax-4h/
    Cheers!! 

  2. Francesco78 • 04/22/2017 #

    Thank you Enrique for your precious suggestion!
    Ill try to incorporate it for sure (once I understand it :))) 
    Best Regards
    Francesco 

    • Francesco78 • 04/22/2017 #

      Enrique, I have added the Dax Seasonality on the 1hr TF and did some positioning modification.
      I attach the code and the picture with the comparison.
      Best Regards
      Fr
      // EUR/USD(mini) - IG MARKETS
      // TIME FRAME 1H
      // SPREAD 2.0 PIPS

      DEFPARAM CumulateOrders = False
      DEFPARAM FLATBEFORE =090000
      DEFPARAM FLATAFTER =210000
      // 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

      adxperiod = 14
      atrperiod = 14
      indicator1 = adx[adxperiod]
      atr = AverageTrueRange[atrperiod]
      //exitafternbars = 1
      adxval = 19
      atrmin = 25
      position = round(100/atr/2.1666)
      //a=5
      m = 3
      n = 2
      m1 = m-1
      n1 = n

      if atr>atrmin then
      c1 = indicator1 <adxval
      c2 = indicator1 >adxval

      if c1 then
      // short
      IF (abs(open-close) > (atr*m) and close > open) THEN
      sellshort position CONTRACTS AT MARKET
      ENDIF

      //long
      IF (abs(open-close) > (atr*m) and close < open) THEN
      buy position*saisonalPatternMultiplier CONTRACTS AT MARKET

      ENDIF
      endif

      if c2 then
      // long
      IF (abs(open-close) > (atr*n) and close > open and close> DOPEN(1)) THEN
      buy position*saisonalPatternMultiplier CONTRACTS AT MARKET
      ENDIF

      //short
      IF (abs(open-close) > (atr*n) and close < open and close< DOPEN(1)) THEN
      sellshort position CONTRACTS AT MARKET
      ENDIF
      endif
      endif

      if atr<atrmin then
      c1 = indicator1 <adxval
      c2 = indicator1 >adxval

      if c1 then
      // short
      IF (abs(open-close) > (atr*m1) and close > open) THEN
      sellshort position CONTRACTS AT MARKET
      ENDIF

      //long
      IF (abs(open-close) > (atr*m1) and close < open) THEN
      buy position*saisonalPatternMultiplier CONTRACTS AT MARKET
      ENDIF
      endif

      if c2 then
      // long
      IF (abs(open-close) > (atr*n1) and close > open ) THEN
      buy position*saisonalPatternMultiplier CONTRACTS AT MARKET
      ENDIF

      //short
      IF (abs(open-close) > (atr*n1) and close < open) THEN
      sellshort position CONTRACTS AT MARKET
      ENDIF
      endif
      endif
      //if exitafternbars then
      //IF longonmarket and BarIndex - TradeIndex = a Then
      //sell position contracts at Market
      //EndIF

      //IF shortonmarket and BarIndex - TradeIndex = a Then
      //exitshort position contracts at Market
      //EndIF
      //endif

      ancesco 

  3. Francesco78 • 04/22/2017 #

    I have done some more work on this code, I noticed that the strategy was poor when ATR (or VOl) was low, so I thought to make a position sizing inversely proportional to the ATR.
    Further more I created 2 scenarios, 
    1 ATR is bigger than x
    2 ATR is smaller than x
    Now the curve in the 1hr case looks steeper and smoother. 
    I attach the results.
    Regards
     

  4. Francesco78 • 04/22/2017 #

    Enrique, I have added the Dax Seasonality on the 1hr TF and did some positioning modification.
    I attach the code and the picture with the comparison.
    Best Regards
    Fr
    // EUR/USD(mini) - IG MARKETS
    // TIME FRAME 1H
    // SPREAD 2.0 PIPS

    DEFPARAM CumulateOrders = False
    DEFPARAM FLATBEFORE =090000
    DEFPARAM FLATAFTER =210000
    // 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

    adxperiod = 14
    atrperiod = 14
    indicator1 = adx[adxperiod]
    atr = AverageTrueRange[atrperiod]
    //exitafternbars = 1
    adxval = 19
    atrmin = 25
    position = round(100/atr/2.1666)
    //a=5
    m = 3
    n = 2
    m1 = m-1
    n1 = n

    if atr>atrmin then
    c1 = indicator1 <adxval
    c2 = indicator1 >adxval

    if c1 then
    // short
    IF (abs(open-close) > (atr*m) and close > open) THEN
    sellshort position CONTRACTS AT MARKET
    ENDIF

    //long
    IF (abs(open-close) > (atr*m) and close < open) THEN
    buy position*saisonalPatternMultiplier CONTRACTS AT MARKET

    ENDIF
    endif

    if c2 then
    // long
    IF (abs(open-close) > (atr*n) and close > open and close> DOPEN(1)) THEN
    buy position*saisonalPatternMultiplier CONTRACTS AT MARKET
    ENDIF

    //short
    IF (abs(open-close) > (atr*n) and close < open and close< DOPEN(1)) THEN
    sellshort position CONTRACTS AT MARKET
    ENDIF
    endif
    endif

    if atr<atrmin then
    c1 = indicator1 <adxval
    c2 = indicator1 >adxval

    if c1 then
    // short
    IF (abs(open-close) > (atr*m1) and close > open) THEN
    sellshort position CONTRACTS AT MARKET
    ENDIF

    //long
    IF (abs(open-close) > (atr*m1) and close < open) THEN
    buy position*saisonalPatternMultiplier CONTRACTS AT MARKET
    ENDIF
    endif

    if c2 then
    // long
    IF (abs(open-close) > (atr*n1) and close > open ) THEN
    buy position*saisonalPatternMultiplier CONTRACTS AT MARKET
    ENDIF

    //short
    IF (abs(open-close) > (atr*n1) and close < open) THEN
    sellshort position CONTRACTS AT MARKET
    ENDIF
    endif
    endif
    //if exitafternbars then
    //IF longonmarket and BarIndex - TradeIndex = a Then
    //sell position contracts at Market
    //EndIF

    //IF shortonmarket and BarIndex - TradeIndex = a Then
    //exitshort position contracts at Market
    //EndIF
    //endif

    ancesco 

  5. Cosmic1 • 04/22/2017 #

    Hi Francesco,
    I tried on 200k units but results were not good. Flat until your optimisation period then it gets going, which of course means curve fitted and little chance of success going forward. I’m not saying it can’t work but it needs some IN/OUT sampling and WF testing to have a chance of success. If you need help with any of this then let me know. If you want me to test any other than 30min then let me know. Happy to help 🙂 

  6. Cosmic1 • 04/22/2017 #

    https://ibb.co/bvrLGQ

  7. Francesco78 • 04/22/2017 #

    Hi Cosmic1
    Thank you for the time you have devoted to the strategy I posted first of all.
    I was aware of the fact that the original code did not give nice results on a 200k bars backtest, as someone did the test in the section on the forum dedicated to this strategy. https://www.prorealcode.com/topic/dax-adaptable-strategy-breackoutmean-reversion/
    What I think could be  would interesting peraps would be to try the 1hr version of the code whereby I have also added the seasonalities parameter used in pathfinder and navigator system.  I have also rewritten the code in a way that maybe could be more understandable . 
    Maybe the fact that the strategy performs only from 2014 is structural or maybe some changes in the code can be made in order to make it simpler and less dependandt by optimization. 
     
    // dax - IG MARKETS
    // TIME FRAME 1H
    // SPREAD 1.0 PIPS

    DEFPARAM CumulateOrders = False
    DEFPARAM FLATBEFORE =090000
    DEFPARAM FLATAFTER =210000

    //highvolume = average[30](volume)<=volume//
    //lowvolume = average[30](volume)>=volume

    adxperiod = 14
    atrperiod = 14
    indicator1 = adx[adxperiod]
    atr = AverageTrueRange[atrperiod]
    //exitafternbars = 1

    //// OPTIMIZED VARIABLES/////
    adxval = 19
    atrmin = 25
    m = 3 // high vol coefficient for mean reversion
    n = 2 //high vol coefficient for brekout
    m1 = m-1 // low vol coefficient for mean reversion
    n1 = n// low vol coefficient for breakout
    ///////////////////////////////////////

    positionlong = saisonalpatternmultiplier*round(100/atr/2.1666)//define sixe of long trades
    positionshort = round(100/atr)// define size of short trade
    //a=5
    lowvolenvironment = atr<atrmin //define lowvol environment use m1 and n1 as coefficient of movement
    highvolenvironment = atr> atrmin //define highvol environment use m and n as coefficient of movement
    meanrevertingenv = indicator1< adxval //define meanreverting environment
    trendenv = indicator1 > adxval// define trendy environment

    //////description of the possible combinations
    sellhighvolmeanreverting = abs(open-close) > (atr*m) and close > open and meanrevertingenv and highvolenvironment
    buyhighvolmeanreverting = abs(open-close) > (atr*m) and close < open and meanrevertingenv and highvolenvironment
    buyhighvoltrendy = abs(open-close) > (atr*n) and close > open and close> DOPEN(1) and trendenv and highvolenvironment
    sellhighvoltrendy = abs(open-close) > (atr*n) and close < open and close< DOPEN(1) and trendenv and highvolenvironment
    selllowvolmeanreverting = abs(open-close) > (atr*m1) and close > open and meanrevertingenv and lowvolenvironment
    buylowvolmeanreverting = abs(open-close) > (atr*m1) and close < open and meanrevertingenv and lowvolenvironment
    buylowvoltrendy = abs(open-close) > (atr*n1) and close > open and trendenv and lowvolenvironment
    selllowvoltrendy = abs(open-close) > (atr*n1) and close < open and trendenv and lowvolenvironment
    ////////////////////////////////////////////////////////

    // 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
    IF (buyhighvolmeanreverting or buyhighvoltrendy or buylowvolmeanreverting or buylowvoltrendy ) THEN
    buy positionlong CONTRACTS AT MARKET
    ENDIF

    // short
    IF (sellhighvolmeanreverting or sellhighvoltrendy or selllowvolmeanreverting or selllowvoltrendy) THEN
    sellshort positionshort CONTRACTS AT MARKET
    endif

    //if exitafternbars then
    //IF longonmarket and BarIndex - TradeIndex = a Then
    //sell position contracts at Market
    //EndIF

    //IF shortonmarket and BarIndex - TradeIndex = a Then
    //exitshort position contracts at Market
    //EndIF
    //endif

     

    • bertrandpinoy • 04/22/2017 #

      hello Francesco, are you still working on this strategy?

  8. Cosmic1 • 04/22/2017 #

    Will post in your forum thread.

  9. JR1976 • 04/22/2017 #

    Buon pomeriggio ALe,
    ho notato che  posticipando la parte di codice che esegue il breakout alle 9.00 anziche alle 8.00 , si eliminano alcuni trade e il drawdown diminuisce notevolmente  , sarebbe  interessante verificare con un backtest più ampio ( io arrivo solo fino a  maggio 2016
    ecco il codice  che ne pensi ?
    DEFPARAM CumulateOrders = false//DEFPARAM FLATBEFORE =080000  original//DEFPARAM FLATBEFORE =090000 // TF 30 min IT’s better starting at 9 o clockDEFPARAM FLATAFTER =210000startbreak = 90000startrevert = 80000
    adxval = 20//adxval = 25ATRperiod = 12//adxperiod = 15adxperiod = 15indicator1 = adx[adxperiod]atr = AverageTrueRange[ATRperiod]
    //m = 3//n = 2m = 3n = 2c1 = indicator1 <adxvalc2 = indicator1 >adxval
    if time  >= startrevert thenif c1 then// shortIF (abs(open-close) > (atr*m) and close > open)   THENsellshort  1 CONTRACTS AT market//trading = 0//SET STOP pLOSS losses//SET TARGET pPROFIT profitsENDIF
    //longIF (abs(open-close) > (atr*m) and close < open)   THENbuy  1 CONTRACTS AT  market//SET STOP pLOSS losses//SET TARGET pPROFIT profitsENDIFendifendif
    // new//MM100 = Average[200](CLose)///testIf time >= startbreak thenif c2 then// longIF (abs(open-close) > (atr*n) and close > open and close> Dhigh(1))   THENbuy  1 CONTRACTS AT market//trading = 0//SET STOP pLOSS losses//SET TARGET pPROFIT profitsENDIF
    //short//if DCLose(1) < MM100 thenIF (abs(open-close) > (atr*n) and close < open and close< Dlow(1))  THENsellshort  1 CONTRACTS AT market//SET STOP pLOSS losses//trading = 1endifendifendif
    set stop ploss 250//IF shortonmarket and trading = 1  and close<tradeprice – 20 then//exitshort at market//endif

  10. Francesco78 • 04/22/2017 #

    Ciao JR 
    Francesco here not Ale :))
    thanks so much for checking the code, I will have a look, unfortunately me too I dont have 200k backtest

  11. Francesco78 • 04/22/2017 #

    Ciao JR 
    Francesco here not Ale :))
    thanks so much for checking the code, I will have a look, unfortunately me too I dont have 200k backtest. 
    In any case check the forum as I posted few variations of the code
    Thank you!

  12. JR1976 • 04/22/2017 #

    Ok sorry Francesco 🙂
     

  13. Francesco78 • 04/22/2017 #

    These are the comparison with my lates version and yours, I think it improves by all the measures. So great! thank you again
     

  14. Juan Salas • 04/22/2017 #

    Hi Francesco,
    First of all, congratulations for your work and thanks for your contributions. I am one of your strategies’ most devoted follower.
    As a beginner, it may seems a simple question. I am studying this code (Seasonal, nor Adaptable) and I can see that the number of positions are depending on the ATR and the Seasonal Index you give to the different months.
    The thing is than when I place the strategy in the ProRealOrder, automatically it asks you how many contracts I want to place/order (example: 1), so when the strategy is triggered I can see that I just have one contract open.
    Probably there is a logical answer that because, I am a beginner, don’t reach to see, so I would appreciate it if you or anyone in this Forum could enlighten me about it.
    Thanks in advance,
    Juan  

  15. Francesco78 • 04/22/2017 #

    Hi Juan Salas and thank you very much for your undeserved compliments.
    I’m not sure if I undertand correctly your question, if you refer to the fact that the sistem ask you the max position allowed before running the code live, it is just a form of extra security the system adopt. 
    For this strategy, run a backtest and see how much is the max position that is taken in history, alternatively you can modify the code to a fixed size.
    When it ask the question of max position, input what you think is your max tolerable size, if you instead decide to run the code with a fix position, just put this fix position in the system when it asks.
    Hop that helps

  16. Juan Salas • 04/22/2017 #

    Hi Francesco,
    Yes, this is pretty much the question. The system ask me a number of contracts the moment I go live. I have checked the backtest history and it match with the number of contracts I am putting in the box.
    Bottomline, right now with my limited capital, I will stick to your Hammernegated and MeanReverting for oil, which it is more “understandable” for me, and I can place Stops Losses and control the number of contracts. The Seasonable Breakout is for “big boys” 🙂 :), but I will try to come back to it later.
    In any case, thanks so much for your answer and in the name of all those members who can’t produce/code a decent equity curve yet.
    Best,
    Juan 

  17. Francesco78 • 04/22/2017 #

    ok sounds good, you can put min size = 1 and go for the seasonable breakout too, also you can get rid of the seasonals to avoid variable position

  18. JR1976 • 04/22/2017 #

    HI all ,
    anyone test 200k bar for this great code ?

  19. JanWd • 04/22/2017 #

    Thank you for the coding, it seems promising.
    FTSE gives for the short term (5 min) promising results, but as always reliability is the key, not sure about that.

  20. Jan Wind • 04/22/2017 #

    21.04.2019: I retested the strategy for the DAX 5 minutes , it works fine for 10.000 bars, but gives sloppy results for 100.000 bars. . . the gold is to find the additional setting where it better fits all market slopes for the DAX . . . .

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+5 more likes

Related users ' posts
Wing Yes, investigate as much as you want. For more insight, you can view the linet1, linet2 etc....
CKW Hi Wing, Thanks for your sharing. I am still trying to breakdown & understand your code...
Wing Hello CKW. No, the parameter, 7 in this case, is used when calling the RSI indicator to ide...
Nacho Buenos días Raul, tengo puesto este sistema desde hace unos días en una cuenta demo en la ve...
Dominik Hola Raul ... it looks wonderful :-) Why does it not work if I use less than 100,000 € capi...
Bobbi Hola y gracias por compartir! Descubrí que en 5 minutos teníamos algo muy bueno! Pero no ...
pascal3431 Salut Doc , Je ne vois pas ce qui fait office de stop dans ce code .. un retour dans le nua...
Doctrading Bonjour, Il s'agit juste d'une stratégie où on est toujours en position : soit à l'achat / ...
pascal3431 Bonjour, après quelques essais sur EUR/USD au M15 en rajoutant(car sinon on est en perte) u...
Nicolas You'll need to preload bars to get the good calculations of you indicators. I did not test i...
David Nicolas I tried DEFPARAM Preloadbars = 5000 And still the same drawn output of entries/exit...
marcara Hi, Thank you very much for the Moving Average Daily indicator, I am using it as indicator i...
Doctrading Nice Job ! Here is my version of the code :  KBO = 0 Tenkansen = (highest[9](high)+lowe...
gefinance Thanks for this code. The only thing left missing is the time lapse, otherwise, lots of old...
danhei Hi I am tryong to figure out how trist strategy works. I am new to pro real time. Can some...
Plop61 Hello,Thank you for sharing this beautiful strategy.Is it possible to indicate the code for ...
NoName Thank you very much for this fascinating trading system. It is still proving to be extremely...
ALE
8 years ago
pollon Ciao Ale,  anche a me da questo errore  "QQE_QUDAX1HBUY"  "QQE_QUDAX1HSELL"  "UNIV_QUDAX...
reb Hi Ale do you trade these QU strategies?  Are the results same as backtests Thnaks in adv...
avatar
crazytrader Hi anyone that has run this lately?
larouedegann best with this hour IF TIME =081000 THEN plushaut=highest[2](high) plusbas = lowest[2](lo...
CanAny1Trade Hi! I'm trying to put together a similar indicator but struggling. I want to mark the NY Pit...
ALE Hi Pat This code was nothing more than an experiment
pat95162 Hi Ale Do you have same results as me ? The strategy works very well in 2017 and now in 2-...
Nicolas Built on the history means that it suits the history. Always develop ideas in In-Sample peri...
ALE
9 years ago
ALE no, only with TF 15m
enzo_52 Grazie tante, Thanks so much 
JanWd Hallo Ale, First of all, thank you for this strategy. Could you explain what the BLUSTER ...
Nicolas Line 10: Volume of current candlestick must be at least 1.5 higher than the previous one and...
bibifricotin Bonjour Nicolas je viens d'essayer ce screener mais j'obtiens des résultats curieux .Aujourd...
Nicolas Décalage si compte gratuit fin de journée ?
Cosmic1
9 years ago
Cosmic1 Lets discuss here: https://www.prorealcode.com/topic/cac-breakout-ported-to-other-markets/
rejo007 hello, anybody use thi strategy for a long time? thanks
abacus23 Hi, I have been trading this strategy and it seems to work quite well recently. Is there a...
Elsborgtrading No that is wrong :) 1st runs always- then only run 2nd if 1st is on market with positions(ar...
Elsborgtrading It can only be fully automated if IG change minimum SLto 7 at night on DAX multi timefra...
Elsborgtrading A small example. the strategy would have opened 3 position on Dec 4th 2016 and keept it for ...
Cosmic1
9 years ago
Cosmic1 @JadeDB What times are you putting in?
sincitytrader I tried this one out recently,  and wasn't profitable for me.
Cosmic1 Yes, not great lately. I stopped this live at the end of last year. Will wait to see when th...
rpreviteri Hi Nicolas, thanks a  loto for sharing your knowliedge, Wasn't the original momentum pinball...
air Thank you!  
elanoa Buonasera sig. Nicolas......sarebbe possibile far in modo che quando l'indicatore raggiunga ...
Philip Raphael Hey! Thank so much for sharing this wonderful indicator! I have always tried to code a simil...
CKW Hi Philip, What do you mean "Years" are not defined ? candle? If to code yearly candle size...
dakaodo Years not defined was probably b/c Phillip copied and pasted the code into PRT instead of im...
Dimi.A Perfect for counter-trend scalping. I like this!
viktorthuns Hi Nicolas! Great work you've done with all your indicators. Just wondering about the code a...
Nicolas the value is not a boolean but an average of an addition of booleans. As stated in the descr...
zilliq The reasons why I think it's time consuming and we loose time to try to do backests and Auto...
filiprb Hello Zilliq, You don't need a system to produce a walk forward test. You can easily create...
Philip Raphael It is incredible! Thanks for sharing, Doctrading!
Doctrading Hello, As I said, I didn't use spread for the screenshot as I don't trade Gold and I don't ...
smurfy Hi, I had been losing on gold and after I manually go through the 5min chart using IG and w...
eiffel Hi Smurfy, hope you are still there... I would like to help you to write and test the code.
Reiner
9 years ago
Nicolas You should join and read the forum thread about this strategy. There are plenty of different...
Reiner Hi djtaktik and welcome, I have answered your question in the related Pathfinder forum beca...
danver34 is this version the definitive one or from the original one have there been modifications to...

Top