This automatic trading robot use the morning range from 7 o’clock to 9 o’clock of the Dax 30 on a 1 minute timeframe basis. If the price breaks the range up or down, a trade with fixed StopLoss and TakeProfit is set.
This strategy is another version of the famous Open Range Breakout methodology applied on DAX.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
DEFPARAM FLATBEFORE=090100 // Festlegen der Code-Parameter DEFPARAM CumulateOrders = false // Kumulieren von Positionen deaktiviert // einmalige werte once size = 1 once profi = 20 once in = 1 once korrek = 1 sl = 35 // Verhindert das Trading an bestimmten Wochentagen daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0 noEntryAfterTime = 100000 timeEnterAfter = time < noEntryAfterTime // einen trade nur IF (CurrentTime = 010000) then onetrade = 0 ENDIF // Bedingungen zum Einstieg in Long-Positionen IF (CurrentTime = 085900) then high7 = HIGHEST[120](high) low7 = LOWEST[120](low) ENDIF IF (close > high7) AND (CurrentTime >= 090100) then onetrade = 1 ENDIF IF (CurrentTime >= 090100) AND not daysForbiddenEntry AND (onetrade = 0) AND timeEnterAfter THEN BUY size CONTRACT AT high7 STOP ENDIF IF (LONGONMARKET = 1) then onetrade = 1 in = 1 korrek = 0 //l1 = POSITIONPRICE + 0.0008 l2 = POSITIONPRICE - sl //sell at l1 LIMIT sell at l2 stop ENDIF // Bedingungen zum Einstieg in Short-Positionen IF close < low7 AND (CurrentTime >= 090100) then onetrade = 1 ENDIF IF (CurrentTime >= 090100) AND not daysForbiddenEntry AND (onetrade = 0) AND timeEnterAfter THEN SELLSHORT size CONTRACT AT low7 STOP ENDIF IF (SHORTONMARKET = 1) then onetrade = 1 in = 1 korrek = 0 //s1 = POSITIONPRICE - 0.0008 s2 = POSITIONPRICE + sl //EXITSHORT at s1 LIMIT EXITSHORT at s2 STOP ENDIF // korrektur IF (LONGONMARKET < 1) AND (SHORTONMARKET < 1) then in = 0 ENDIF IF in = 0 and korrek = 0 then d1 = POSITIONPERF(1) > 0 d2 = POSITIONPERF(1) < 0 IF d1 and size > 1 then size = size - 1 korrek = 1 ELSIF d2 then size = size + 1 korrek = 1 ENDIF ENDIF // Stops und Targets SET STOP pLOSS 60 SET TARGET pPROFIT sl // Performance IF STRATEGYPROFIT > profi then size = 1 profi = profi + 20 ENDIF |
Share this
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 :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Thank you for sharing!
Although I have a couple of questions:
Why 1 min? Since the range is based over 2h and you enter with stop orders you might as well use 15m to get a larger sample size?
And why a fixed sl/tp? Especially with a small sample size all you do is increase risk of curvefitting?
Best regards,
R
Hello,
nice that you like the strategy.
For 1 minute I have chosen to avoid the first minute in the DAX at 9 o’clock, because this is often very turbulent.
The entrance is at 9 clock 1.
For the SL / TP I’m still testing myself and I’m not sure how to improve the performance.
Do you have an idea how to do that?
Best Regards
Beeb
I have a similar approach running – but yours is also very smart – thanks for sharing!
Thanks
In the buy long if statement, shouldnt you enter long if onetrade = 1 instead of 0 (row 30)?
Was meinst du mit dieser Kode ?
IF (LONGONMARKET = 1) then
onetrade = 1
in = 1
korrek = 0
//l1 = POSITIONPRICE + 0.0008
l2 = POSITIONPRICE – sl
//sell at l1 LIMIT
sell at l2 stop
ENDIF
Mr Beep, nice strategy you have build !
I played around with your code, and made my own variation on your code, see below, just an alternative way of coding (less static)
I am not convinced (yet) about the reliability of the outcomes : if using the code on 100.000 bars, it shows no profit for the first 50.000 bars, I personnally am afraid of overfitting.
Maybe you have a different opinion.
Your question : ” For the SL / TP I’m still testing myself and I’m not sure how to improve the performance.
Do you have an idea how to do that? ===> An good option is to use “Variable optimalization”, for the optimal Take Profit values for short and long positions, could also be used for number of highest and lowest bars to be taken (instead of 120 bars) See also page 30 of the manual, https://www.prorealtime.com/en/pdf/probacktest.pdf
Kind regards,
APPENDIX
DEFPARAM CumulateOrders = true // Kumulieren von Positionen aktiviert
Defparam FLATAFTER = 163000 // Verhindert das Trading nach xx:xx Uhr
DaysForbiddenEntry = (DayOfWeek = 6 OR DayOfWeek = 0) // Verhindert das Trading an bestimmten Wochentagen
Handelszeit = (Time >= 90000 and Time high7 then // Bedingungen zum Einstieg in Long-Positionen
BUY size CONTRACTS AT high7 STOP
sl = round((77/10000 * close)) // stop loss
SET STOP pLOSS sl
pll = round((VARIABLE OPTIMIZATION 3 PL/10000 * close)) // take profit long
SET TARGET pPROFIT pll
else // Bedingungen zum Einstieg in Short-Positionen
IF close < low7 then
SELLSHORT size CONTRACTS AT low7 STOP
sl = round((77/10000 * close)) // stop loss
SET STOP pLOSS sl
pss = round(VARIABLE OPTIMIZATION 4 PS/10000 * close) // take profit short
SET TARGET pPROFIT pss
ENDIF
endif
endif
Thank you for this code that seems to work well. But, if i’m not wrong, we can have buy and short conditions at the same time. So how can the code “decide” between sell and short?
sorry, I was wrong in my previous message: it’s not possible to have both conditions at the same time
hi beeb,
i watched your BOut strategy and i like it very much.
your code allows only one trade. (long or short).
what has to be changed in your code, if i like to have maximum 2 trades , so one short and one long, if the events of your code will be matched.
thx for your support
Hallo beeb,
ich schreibe kurz auf Deutsch und falls es von Wert ist übersetze ich es gerne.
Vielen Dank für Deine Strategie … sieht schon mal super aus.
Habe eben anstatt dem SL einen 45 TrailingStop verwendet und TP = 55 (hat mir die Analyse so raus geworfen).
Durch den Trailing Stop finden keine so großen Abbrüche mehr statt.
Sollte doch real dann auch funktionieren …oder???
Es sei denn ich habe etwas übersehen.
Beste Grüße
Dominik
Hallo Dominik, das mit dem deutsch schreiben kommt mir sehr gelegen. Komme auch aus Deutschland.
Also mit deinen werten komme ich auf eine kleine Verbesserung was den Gewinn angeht aber auch auf einen Max. Drawdown von 890,20 € .
Wenn ich die werte so lasse auf einen Drawdown von 0 €. und die Ratio ist auch minimal besser 0,03 punkte, ist aber denke ich bei dem unterschied zu vernachlässigen.
Man kann sicher noch an ein paar schrauben drehen und kitzelt noch ein bisschen Performanz raus.
Es gilt nur die richtigen Regler zu finden 😉
Gruß Benny
// Stops und Targets
SET STOP pLOSS 0
SET STOP PTRAILING 45
SET TARGET pPROFIT 55
hi Beeb, I imported the file in my platform but is does open any order.
What is wrong , what should I check ?
Thanks
Vincenzo
Ciao, scusami ma non mi esegue il back test, da cosa può dipendere?
Grazie
Hello
have you used this strat since last year ? live or Back test ?
What are the results ?
Yes last Year.
But only back test
Hi all,
did anyone test this strategy recently? As i dont get a single trade in the backtest. Any Ideas?
Thanks in advance