I am posting this strategy well known by most of you, but with some slight modifications. I would APPRECIATTE if someone could identify what is wrong.
It seems to work but I cannot get all the conditions right in the backtest. I am new with programming, and I am frustrated with this system because I cannot get one operation everyday, or when I get it, the system is launching the orders at the same time everyday, etc.
The system is a simple morning breakout for EUR-USD (TF: 15 min).
1.Starts at 08:00h and collect the highest and lowest from the last 12 candlesticks (from 05:00 to 08:00h).
2. After 08:00h, when the price breaks the highest of the channel + 3 pips, or the lowest of the channel– 3 pips, buy long or sell short (in the same candle, not at the opening of the next candle).
3. Stops and Target Profits finish the trading.
4. Only operates once a day, regardless if the trade was positive or negative.
5. The system will shut down at 14:00h. Any open trade will be close at that time.
6. I have included a NON OPERATING condition, in case the range of the channel of the 12 candlesticks is bigger than 32 pips.
Although it seems very basic and the equity curve is not very attractive right now, I like the fact that I can control the operations once a day and limit and daily monitoring the results. It is a matter of adding other currencies everyday, and creating different schedules for US and Asian markets (i.e.- I could have 5 currencies from 0800 to 1400, 5 from 1500 to 2200, and other five overnight for Asian market). It is just a matter, once it works, to change the time in the code).
Thanks so much in advance,
Juan
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
// FOREX BREAKOUT
// 15 MIN
// One trade per day, from 08:00h to 14:00. The system shuts-down at 14:00h
// Everyday Channel formation from 0500 to 0800 (Highest-Lowest)
// Maximum Range 32pips
DEFPARAMCUMULATEORDERS=false
// OPERATIONAL TIME
DEFPARAMFLATBEFORE=080000
DEFPARAMFLATAFTER=140000
Operationaltime=TIME>080000ANDTIME<140000
// ONE TRADE PER DAY. It resets the variable each new day
IFINTRADAYBARINDEX=0THEN
alreadytraded=0
ENDIF
// RANGE between 0500h to 0800h
IFTIME=080000THEN
channelhigh=Highest[12](high)
channellow=Lowest[12](low)
ENDIF
// NO ACTIVITY if the range (highest-lowest)is >= 32 pips
Your pending stop orders will only last 1 single bar in your code. Pending orders must be set each bar, because they only last 1 candlestick. In order to let the system put the STOP Orders continuously at each new bar until one of them triggered you should try this modified code instead:
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
// FOREX BREAKOUT
// 15 MIN
// One trade per day, from 08:00h to 14:00. The system shuts-down at 14:00h
// Everyday Channel formation from 0500 to 0800 (Highest-Lowest)
// Maximum Range 32pips
DEFPARAMCUMULATEORDERS=false
// OPERATIONAL TIME
DEFPARAMFLATBEFORE=080000
DEFPARAMFLATAFTER=140000
Operationaltime=TIME>080000ANDTIME<140000
// ONE TRADE PER DAY. It resets the variable each new day
IFINTRADAYBARINDEX=0THEN
alreadytraded=0
ENDIF
// RANGE between 0500h to 0800h
IFTIME=080000THEN
channelhigh=Highest[12](high)
channellow=Lowest[12](low)
ENDIF
// NO ACTIVITY if the range (highest-lowest)is >= 32 pips
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue