Simple 1H strategy on DAX (1EUR)
The aim of this strategy is to take a position after a succession of 3 consecutive candles of the same color. Strict hourly conditions allow the strategy to enter into position only at predetermined fixed times:
- buy orders only at 12:00
- sell orders only at 16:00
Trades are automatically closed at the end of the day.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
// DAX (1E) - IG MARKETS // TIME FRAME 1H // SPREAD 2.0 PIPS DEFPARAM CumulateOrders = False DEFPARAM FLATBEFORE = 100000 DEFPARAM FLATAFTER = 210000 // LONG IF (time = 120000 and close > open and close[1] > open[1] and close[2] > open[2]) THEN BUY 1 CONTRACTS AT MARKET SET STOP pLoss 30 SET TARGET pPROFIT 45 ENDIF // SHORT IF (time = 160000 and close < open and close[1] < open[1] and close[2] < open[2]) THEN SELLSHORT 1 CONTRACTS AT MARKET SET STOP pLoss 30 SET TARGET pPROFIT 45 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 :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Hi! I don’t have as much history as you do but what about adding a moving average to the code? Improves the return the last 4 years.
// LONG
IF (time = 120000 and close > open and close[1] > open[1] and close[2] > open[2]and close > average[100]) THEN
BUY 1 CONTRACTS AT MARKET
SET STOP pLoss 40
SET TARGET pPROFIT 50
ENDIF
// SHORT
IF (time = 160000 and close < open and close[1] < open[1] and close[2] < open[2] and close < average[100]) THEN
SELLSHORT 1 CONTRACTS AT MARKET
SET STOP pLoss 40
SET TARGET pPROFIT 50
ENDIF
Thanks for commenting! In general I try to avoid using moving averages, but yes, performance is slightly better!
Alright. Anyway I like the simplicity of your code!
Thanks!!!
Hi bjoern. Many thanks for posting the attached strategy. I would however point out that the results shown include “zero bar” trades so will not be as reliable. Upon using tick by tick backtesting the overall profit is reduced by around 20%. This means that the strategy is still positive so looks promising and is probably worthy of more work and refinement.
Kind Regards
You are absolutely right, thank for your comment. Already working on an optimization while using tick-by-tick data
Added a range filter for entering positions. Performance seems to be much better, even with tick-by-tick data.
// DAX (1E) - IG MARKETS
// TIME FRAME 1H
// SPREAD 2.0 PIPS
DEFPARAM CumulateOrders = False
DEFPARAM FLATBEFORE = 100000
DEFPARAM FLATAFTER = 210000
sum = abs(open-close)+abs(open[1]-close[1])+abs(open[2]-close[2])
// LONG
IF (time = 120000 and close > open and close[1] > open[1] and close[2] > open[2] and sum > 40 and sum < 220) THEN
BUY 1 CONTRACTS AT MARKET
SET STOP pLOSS 100
SET TARGET pPROFIT 200
ENDIF
// SHORT
IF (time = 130000 and close < open and close[1] < open[1] and close[2] < open[2] and sum > 40 and sum < 220) THEN
SELLSHORT 1 CONTRACTS AT MARKET
SET STOP pLOSS 100
SET TARGET pPROFIT 200
ENDIF
Thanks!
btw this strategy has an edge on Bund 1h as well
With the same parameters? For me the results are negative
yes! It’s not like you want to put it on live but when I for example take the version I have for DAX and put it on Bund without changing any values it’s still holding up pretty good which is always nice to see 🙂
Oh ok, with the initial posted parameters it is positive