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 • 188 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 • 188 days ago #

    Hello Jake
    you’re welcome!

     DEFPARAM FLATAFTER = 060000
    LIMITHOUR = 031400
    STARTHOUR = 181500
    IF TIME = 170000 THEN
     
    • JakeDB • 187 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 • 185 days ago #
      Hello Jake 
      have you solved the problem?

    • JakeDB • 184 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 • 184 days ago #

      Hi 

      what time is it now for you?

  3. Cosmic1 • 188 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 • 188 days ago #

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

    • arke • 60 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 • 188 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 • 188 days ago #

      The variables are the results of the optimization.

    • ALE • 188 days ago #

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

  5. ALE • 188 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 • 188 days ago #

    grande Ale, ottimi contributi!

     

  7. CKW • 186 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 • 186 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 • 186 days ago #

    Excellent! Wait for your good news!

  10. JakeDB • 184 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 • 178 days ago #

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

    • ALE • 178 days ago #

      Hi Senator-fred

      Time  setting is as follow: 

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

    Thank´s, problem is solved…

  13. Luca81 • 159 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 • 159 days ago #

      Hello Luca,
      no this strategy is overfitted. 

  14. traderfred • 113 days ago #

    Hello ALE

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

    I don’t understand what is “overfitted”.

  15. ALE • 113 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..

    • David Somogyi • 30 days ago #

      Hello ALE

      I’ve been running your strategy in demo for the last two weeks, but it hasn’t entry once, also i have noticed from December to March has only 1 position opened. Are you still running this system on demo or real?

      Thanks

  16. fepabe • 89 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 avatar avatar avatar
Related users ' posts
bjoern You are absolutely right, thank for your comment. Already working on an optimization while u...
bjoern Added a range filter for entering positions. Performance seems to be much better, even with ...
Nicolas Thanks!
ALE Thanks Paris
iramirez55 Bonita estrategia. Gracias ALE
ALE ... thanks I hope could help our community!
Dagge99 Why are you the only one sharing unfinished strategys that doesn't perform well? To help us ...
Nicolas What are you calling a finished strategy? This one has been coded by a request on forums, si...
clanli Hi Nicolas Thanks for a fantistic piece of code. I tried the following with really good res...
Elsborgtrading I have moved the development topic https://www.prorealcode.com/topic/development-of-initial-...
Elsborgtrading Sometime along the way since I coded the Indicator something has change in PRT- at least I t...
Elsborgtrading Btw last code was a 10 min TF ver. 
Derek Nice strategy. Have you tried adding a stop loss since there are a few sharp drawdowns? I ...
Piston_Broke Non so .... da qui la mia domanda iniziale :-)
Piston_Broke Hi Derek. I have tried many different ways to apply SL's to this and similar versions of th...
Nicolas Indeed, if you are not willing to loose, you will always win. Averaging down losers can carr...
David You're always safer going Long especially with averaging down on an index as the probability...
Oskar Bergvall  I noted Davids and Nicolas remarks. Could it be possible to make an indicator for contraria...
bluetime6 Hello Nicolas. Can i ask you for something? I backtested your strategy in Dax 4H Timeframe...
Francesco78 Thank you Nicolas,  I have copied your nice indicator, but it shows in the lower part of th...
Abz  hi , you need to add the indicator from the "price" menu in chart
Francesco Thank you Abz!
Lotar
2 months ago
Lotar Hi Plop61, thanks for your comment. To make the code for short positions is possible. But ...
JvdG Hi Lotar, your strategy raised my interest; I did some tests and made a few adjustments fit...
Nicolas You can send it to contact@prorealcode.com and I'll attach it here. Thanks for your sharing!
iramirez55 thanks for all
johnymon Hi Reiner, Many thanks for the  superb strategy.I just tried to back-test on prerealtime bu...
Reiner Hi Joy John, Navigator will allways sell at 9:00 at the first tdom and will accumulate a lo...
SAM
2 months ago
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...
Nicolas For everyone information, a discussion thread is ongoing here: https://www.prorealcode.com/t...
larouedegann Bonjour Nicolas, comment se fait-il qu'avec cette stratégie stop loss à 5 pips, PRT mettant...
Nacho Buenos días Raul, tengo puesto este sistema desde hace unos días en una cuenta demo en la ve...
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...
Elsborgtrading Hi Triss. the File is in the post for download. There is nothing wrong with the code. Your e...
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 ...
ALE
6 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
6 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 

Top