Breakout intraday trading strategy on DAX

Breakout intraday trading strategy on DAX
Please find below another breakout intraday trading strategy built upon the breakout code Nicolas and Cosmic1 have already shared in the Library.

This one is for DAX 15 minutes, please change your time-zone accordingly to the obtained results (GMT+2 = Rome/Paris time-zone).

Tests were made with 1 point spread and results are quite good over the last years. Please share your thoughts and maybe improvements in the comments below. Thanks.

 
// MAIN CODE : BREAKOUT STRATEGY BY NICOLAS, COSMIC1
// INSPIRED BY BRAKOUT DAX 15MIN - COSMIC1 AND PROREALCODE SHARING COMMUNITY
//-------------------------------------------------------------------------
// IG MARKET GERMANY 30 CASH (EUR 1 MINI) - SPREAD 1 - 15 MIN
// WE DO NOT STORE DATA UNTIL THE SYSTEM STARTS.
// IF IT IS THE FIRST DAY THAT THE SYSTEM IS LAUNCHED AND IF IT IS AFTERNOON,
// IT WILL WAIT UNTIL THE NEXT DAY FOR DEFINING SELL AND BUY ORDERS.

//ALL TIMES ARE +0200 UTC/GMT

DEFPARAM PRELOADBARS = 0

// POSITION IS CLOSED AT 21H00 PM
DEFPARAM FLATAFTER = 210000

// NO NEW POSITION WILL BE INITIATED AFTER THE 16:00PM CANDLESTICK. ANY EXISTING ORDERS CANCELLED AT 17:15PM
LIMITHOUR = 181400

// MARKET SCAN BEGIN WITH THE 15 MINUTE CANDLESTICK THAT CLOSED AT 9:15AM
STARTHOUR = 091500

IF  DAYOFWEEK =1 THEN
TRADINGDAY = 0
ELSE
TRADINGDAY = 1
ENDIF

// VARIABLES THAT WOULD BE ADAPTED TO YOUR PREFERENCES
IF TIME = 080000 THEN
//POSITIONSIZE = MAX(1,1+ROUND((STRATEGYPROFIT-1000)/1000)) //GAIN RE-INVEST TRADE VOLUME
POSITIONSIZE = 1 //CONSTANT TRADE VOLUME OVER THE TIME
ENDIF
MAXAMPLITUDE = 120
MINAMPLITUDE = 60
ORDERDISTANCE = 7
POURCENTAGEMIN = 20

// VARIABLE INITILIZATION ONCE AT SYSTEM START
ONCE STARTTRADINGDAY = -1

// VARIABLES THAT CAN CHANGE IN INTRADAY ARE INITILIAZED
// AT FIRST BAR ON EACH NEW DAY
IF (TIME <= STARTHOUR AND STARTTRADINGDAY <> 0) OR INTRADAYBARINDEX = 0 THEN
BUYTRESHOLD = 0
SELLTRESHOLD = 0
BUYPOSITION = 0
SELLPOSITION = 0
STARTTRADINGDAY = 0
ELSIF TIME >= STARTHOUR AND STARTTRADINGDAY = 0 AND TRADINGDAY = 1 THEN

// WE STORE THE FIRST TRADING DAY BAR INDEX
DAYSTARTINDEX = INTRADAYBARINDEX
STARTTRADINGDAY = 1
ELSIF STARTTRADINGDAY = 1 AND TIME <= LIMITHOUR THEN

// FOR EACH TRADING DAY, WE DEFINE EACH 15 MINUTES
// THE HIGHER AND LOWER PRICE VALUE OF THE INSTRUMENT SINCE STARTHOUR
// UNTIL THE BUY AND SELL TRESHOLDS ARE NOT DEFINED
IF BUYTRESHOLD = 0 OR SELLTRESHOLD = 0 THEN
HIGHLEVEL = HIGHEST[INTRADAYBARINDEX - DAYSTARTINDEX + 1](HIGH)
LOWLEVEL = LOWEST [INTRADAYBARINDEX - DAYSTARTINDEX + 1](LOW)

// SPREAD CALCULATION BETWEEN THE HIGHER AND THE
// LOWER VALUE OF THE INSTRUMENT SINCE STARTHOUR
DAYSPREAD = HIGHLEVEL - LOWLEVEL

// MINIMAL SPREAD CALCULATION ALLOWED TO CONSIDER A SIGNIFICANT PRICE BREAKOUT
// OF THE HIGHER AND LOWER VALUE
MINSPREAD = DAYSPREAD * POURCENTAGEMIN / 100

// BUY AND SELL TRESHOLDS FOR THE ACTUAL IF CONDITIONS ARE MET
IF DAYSPREAD <= MAXAMPLITUDE THEN
IF SELLTRESHOLD = 0 AND (CLOSE - LOWLEVEL) >= MINSPREAD THEN
SELLTRESHOLD = LOWLEVEL + ORDERDISTANCE
ENDIF
IF BUYTRESHOLD = 0 AND (HIGHLEVEL - CLOSE) >= MINSPREAD THEN
BUYTRESHOLD = HIGHLEVEL - ORDERDISTANCE
ENDIF
ENDIF
ENDIF

// CREATION OF THE BUY AND SELL ORDERS FOR THE DAY
// IF THE CONDITIONS ARE MET
IF SELLTRESHOLD > 0 AND BUYTRESHOLD > 0 AND (BUYTRESHOLD - SELLTRESHOLD) >= MINAMPLITUDE THEN
IF BUYPOSITION = 0 THEN
IF LONGONMARKET THEN
BUYPOSITION = 1
ELSE
BUY POSITIONSIZE CONTRACT AT BUYTRESHOLD STOP
ENDIF
ENDIF
IF SELLPOSITION = 0 THEN
IF SHORTONMARKET THEN
SELLPOSITION = 1
ELSE
SELLSHORT POSITIONSIZE CONTRACT AT SELLTRESHOLD STOP
ENDIF
ENDIF
ENDIF
// CONDITIONS DEFINITIONS TO EXIT MARKET WHEN A BUY OR SELL ORDER IS ALREADY LAUNCHED
IF LONGONMARKET AND (TIME> LIMITHOUR) THEN
SELL AT SELLTRESHOLD STOP
ELSIF SHORTONMARKET AND (TIME > LIMITHOUR) THEN
EXITSHORT AT BUYTRESHOLD STOP
ENDIF

// LOGIC TRAILING STOP
TGL =22
TGS=21
//RESET
IF NOT ONMARKET THEN
MAXPRICE = 0
MINPRICE = CLOSE
PREZZOUSCITA = 0
ENDIF
//SE LONG ALLORA:
IF LONGONMARKET THEN
MAXPRICE = MAX(MAXPRICE,CLOSE) //SAVING THE MFE OF THE CURRENT TRADE
IF MAXPRICE-TRADEPRICE(1)>=TGL*POINTSIZE THEN //IF THE MFE IS HIGHER THAN THE TRAILINGSTOP THEN
PREZZOUSCITA = MAXPRICE-TGL*POINTSIZE //SET THE EXIT PRICE AT THE MFE - TRAILING STOP PRICE LEVEL
ENDIF
ENDIF
IF SHORTONMARKET THEN
MINPRICE = MIN(MINPRICE,CLOSE) //SAVING THE MFE OF THE CURRENT TRADE
IF TRADEPRICE(1)-MINPRICE>=TGS*POINTSIZE THEN //IF THE MFE IS HIGHER THAN THE TRAILINGSTOP THEN
PREZZOUSCITA = MINPRICE+TGS*POINTSIZE //SET THE EXIT PRICE AT THE MFE + TRAILING STOP PRICE LEVEL
ENDIF
ENDIF
//EXIT ON TRAILING STOP PRICE LEVELS
IF ONMARKET AND PREZZOUSCITA>0 THEN
EXITSHORT AT PREZZOUSCITA STOP
SELL AT PREZZOUSCITA STOP
ENDIF
// MAXIMAL RISK DEFINITION OF LOSS PER POSITION
// IN CASE OF BAD EVOLUTION OF THE INSTRUMENT PRICE
SET STOP PLOSS MAXAMPLITUDE +(MAXAMPLITUDE)
ENDIF
//Regards Ale
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?

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

  1. JakeDB • 134 days ago #

    Hi ALE, 

    Thanks for posting this. 

    When i am changing times to suit my timezone (sydney Australia) am i changing FLATAFER, LimitHour, StartHour & IF TIME. 

    or just the IF time? 

    I am not understanding what to be changing . Sorry for this question. 

  2. ALE • 133 days ago #

    Hello Jake
    you’re welcome!

     DEFPARAM FLATAFTER = 060000
    LIMITHOUR = 031400
    STARTHOUR = 181500
    IF TIME = 170000 THEN
     
    • JakeDB • 133 days ago #

      Hi Ale, 

      Thanks for your response. I am very new to this so just trying to get my head around the variables that i need to enter to get some results for this backtest?

      I take it i am altering the buythresholds etc. I am not understanding your code to well. 

      Sorry for wasting your time with these questions. 

      Regards, 

    • ALE • 130 days ago #
      Hello Jake 
      have you solved the problem?

    • JakeDB • 130 days ago #

      Hi Ale, 

      No i have not been able to get any results at all. I must not have my variables correct or the time. I am not 100% sure what i am doing wrong. 

      Thanks

    • ALE • 130 days ago #

      Hi 

      what time is it now for you?

  3. Cosmic1 • 133 days ago #

    Hi Ale, thanks for sharing. Do you think this version is curve fitted to the last two years? Did you avoid it some how? For 6 six years it did not do too much but only works in the last 2.. 2 Point spread is probably more realistic as you are closing a lot of trades when spread has changed. Cheers

    • ALE • 133 days ago #

      I don’t understand, what do you think about?

    • arke • 6 days ago #

      Hi Cosmic,

      I saw that you are able to do a backtest on DAX in 15Min timeframe till 6 years ago. In my PRT 10.3 i can only go back 2 years. Which Version are you using?

  4. Cosmic1 • 133 days ago #

    I think with only 156 trades it is easy to curve fit. It would be more promising to see that it has worked over many years or many more trades. Only my thoughts of course. How did you pick the variables?

    • ALE • 133 days ago #

      The variables are the results of the optimization.

    • ALE • 133 days ago #

      I’m using the platform complete version and I have only 100.000 bars to optimized the strategy. 

  5. ALE • 133 days ago #

    I think that historical data are very important, If it doesn’t work in the last year may be a problem of performance. I think that it show the volatily of the dax.

  6. criscolci • 133 days ago #

    grande Ale, ottimi contributi!

     

  7. CKW • 132 days ago #

    Hi ALE,
    Thanks for your sharing. Nice code.
    However, Buy/sell at Price may lead to different result for Probacktest vs Live. Same case for your strategy?
    br,
    CKW

  8. ALE • 132 days ago #

    thanks 

    I put it to work only yesterday on the demo account. I expect at least ten operations to see if the results are confirmed.

  9. CKW • 132 days ago #

    Excellent! Wait for your good news!

  10. JakeDB • 130 days ago #

    Hi Ale, 

    No i have not been able to get any results at all. I must not have my variables correct or the time. I am not 100% sure what i am doing wrong. 

     

  11. senator-fred • 123 days ago #

    Unfortunately I´ve got no results too….Do i have to change the timesettings? Im in Germany…
    best Regards.. 

    • ALE • 123 days ago #

      Hi Senator-fred

      Time  setting is as follow: 

      //ALL TIMES ARE +0200 UTC/GMT
  12. senator-fred • 121 days ago #

    Thank´s, problem is solved…

  13. Luca81 • 105 days ago #

    Hello Ale, is my first comment in this forum. Thanks for your code. I wanted to ask if you are testing this EA on a real account. Thank you Luca

    • ALE • 104 days ago #

      Hello Luca,
      no this strategy is overfitted. 

  14. traderfred • 58 days ago #

    Hello ALE

    is that mean you are not going to use it live?

    I don’t understand what is “overfitted”.

  15. ALE • 58 days ago #

    Hello Traderfed,

    because it run many operations over the past three years, instead of having an average of operations performed stable over time..

  16. fepabe • 35 days ago #

    Ciao Ale, porta pazienza ma facendo copia incolla del codice non mi restituisce alcun valore. Devo modificare qualcosa eseguendolo dall’Italia? Grazie.

     

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
iramirez55 thanks for all
Elsborgtrading By adding the inside bar breakout failure candle, which is the next bar after the inside bar...
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...
alemaliz Hello Raul vg the minimum stop on the Dax and mini 1 and not to 18 points how do you insert ...
Raul Vg Hi alemaliz, In the IG broker, the minimum trailing stop is 5 with the open market.  
Nicolas For everyone information, a discussion thread is ongoing here: https://www.prorealcode.com/t...
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...
Doctrading Nice Job ! Here is my version of the code :  KBO = 0 Tenkansen = (highest[9](high)+lowe...
triss1965@gmail.com The code dose not work   Syntax error: line 2, character 12One of the following chara...
triss1965@gmail.com why do I get error ond line whit DAX? Eihter cod works. Can you chare the file?
Elsborgtrading Hi Triss. the File is in the post for download. There is nothing wrong with the code. Your e...
ALE
4 months ago
maxxb a ok quindi potrei anche non aver sbagliato nulla ... grazie ..  
sunandsea12345 scusate sono nuovo del forum ,dove posso chiedere come posso generare un codice che mi perme...
ALE Ciao Puo andare nel forum Supporto pro order In fondo troverai lo spazio per inserire un ...
ALE
5 months ago
enzo_52 Hi Ale, so you have the same results with german 30 mini 1e cash TF 1h?  
ALE no, only with TF 15m
enzo_52 Grazie tante, Thanks so much 
Nicolas
5 months ago
century hi, can we have more explanations please ? about parameters and time unit ? thanks
Nicolas Line 10: Volume of current candlestick must be at least 1.5 higher than the previous one and...
Cosmic1
6 months ago
Cosmic1 Hi Yngve, Amplitude relates to the range of the price action for the given times stipulated...
GAMMA I try as per your advise and change the time to usa time still no luck, may be I am doing so...
Cosmic1 Post the code you are using, will try and figure it out. What broker?
Elsborgtrading Hi Nicolas, and thanks for updating the file. When I backtest the code now I get a complete...
Elsborgtrading Hi Nicolas. I made a mistake. a FTSE chart had sneaked under the DAX and when backtesting I ...
Nicolas "set stop loss" are individual for each order with IG.
Cosmic1
6 months ago
Cosmic1 Hi Vish, Yes it was a good Thursday and Friday where between DAX and DOW breakout +800 point...
JakeDB I cannot get my time conversions correct for Sydney Australia to get any data for this code....
Cosmic1 @JadeDB What times are you putting in?
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...
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...
Reiner
8 months ago
Pathfinder DAX 4H
Pathfinder DAX 4H
191
Strategies
djtaktik Hello reiner, How do you explain that pathfinder have good results on DAX but not on the CA...
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...
Reiner
9 months ago
tradex Hello, what is the simple average period on equity curve ? Thank you in advance
Reiner tradex, open the settings dialog (click on wrench symbol) on the equity curve window and add...
Daniel da Costa Hi Nicolas! Is it possible too reference the MA in the equity curve so as too know whether t...
finplus Bonjour, j'ai retesté hier sur la paire AUD/USD timeframe 1 heure sur mon compte réel chez I...
finplus Bonsoir, j'ai de nouveau aujourd'hui lancé la stratégie en réel sur mon compte IG sur la pai...
AleX 0 improvments, I tried a lot of modified version but no one was working. I think that only w...

Top