One aspect of writing EAs that is common to most autotraders is entering trades in the same direction after the market is turning. This was the main bugbear when I worked on the NB10 EA which could produce excellent returns if the market was mid swing but would overall accumulate more losses at retracements and reversals. It has taken me a long time to workout ways of keeping up with the market. There is always a temptation to make use of lagging indicators because sometimes they work really well, but to keep up with reversals we need to look at price action as well.
Fast exponential moving averages are still lagging when it comes to retracements and reversals, so it is necessary to complement the use of these with faster swing analysis. Previously, I was using D1 ADX to complement D1 EMA 5 & EMA 10 but that was too slow, so I have added both ADX for H4 and M15, ADX on H4 can be helpful for the daily trend when it is running strong, but when it is weaker I look at M15.
I originally read about ADX in one of my trading books but I only took it seriously when I found I was reinventing the wheel, then I understood when and how to use ADX, but it is still a lagging indicator even on M15, nevertheless, this is a good analysis of price action to avoid entering trades when price action is going the wrong way.
I have been working on this EA for so long that is difficult to know whether it is improving or just going round in circles. What is clear is that every time I investigate a late entry or a bad entry I usually learn something important and I try to reflect this in making the EA more adaptive.
I believe it has been a particularly productive week and perhaps I am finally on top of reversals.
The following list is just for hardcore EA writers:
Code: Select all
Bugs, fixes and improvements
================================================================
Missing entry near:
15:33:18 2010.01.04 04:00
Fixed:
1 2010.01.04 04:18 buy 1 0.30 0.89692 0.00000 0.00000 0.00 10000.00
========================================================================
Bad entry at:
XX 2010.01.04 20:33 buy 2 0.30 0.91302 0.00000 0.00000 0.00 10210.60
XX 2010.01.05 14:01 s/l 2 0.30 0.91302 0.91302 0.92144 0.60 10211.20
Fixed
PBRE Buy entry dropped because bD1ZzReversingDown || bH4ZzReversingDown : 0, 1
========================================================================
Good entry dropped:
05:37:57 2010.01.06 12:00 zzbb_mt4b509 AUDUSD,M1: PBRE Buy entry dropped because bReverseD1Doji
make D1 Doji filter conditional: cancel if H4 opposite doji & candle bias
or (open && close) both close to WP && correct side
Fixed:
9 2010.01.06 01:04 buy 2 0.30 0.91272 0.00000 0.00000 0.00 10210.60
========================================================================
Late entry:
16 2010.01.07 18:10 buy 3 0.30 0.91822 0.00000 0.00000 0.00 10421.80
17 2010.01.07 18:10 modify 3 0.30 0.91822 0.90922 0.92714 0.00 10421.80
18 2010.01.08 13:55 modify 3 0.30 0.91822 0.91822 0.92714 0.00 10421.80
19 2010.01.08 15:06 s/l 3 0.30 0.91822 0.91822 0.92714 0.60 10422.40
Fixed by:
PBRE Buy entry dropped because bD1ZzReversingDown || bH4ZzReversingDown : 1, 1
2010.01.08
========================================================================
Wrong direction
20 2010.01.15 06:17 buy 4 0.30 0.92802 0.00000 0.00000 0.00 10422.40
21 2010.01.15 06:17 modify 4 0.30 0.92802 0.91902 0.93694 0.00 10422.40
22 2010.01.18 00:58 s/l 4 0.30 0.91902 0.91902 0.93694 -269.40 10153.00
Fixed by better trend analysis:
bHasIntraDaySlope: 0, iIntraDayDirection: 0
========================================================================
Wrong direction
23 2010.01.19 07:10 buy 5 0.30 0.92542 0.00000 0.00000 0.00 10153.00
24 2010.01.19 07:10 modify 5 0.30 0.92542 0.91642 0.93434 0.00 10153.00
25 2010.01.20 02:02 s/l 5 0.30 0.91642 0.91642 0.93434 -269.40 9883.60
Fixed by better trend analysis:
bHasIntraDaySlope: 0, iIntraDayDirection: 0
========================================================================
Post swing bad entry:
47 2010.02.08 04:03 sell 9 0.30 0.86520 0.00000 0.00000 0.00 10170.76
48 2010.02.08 04:03 modify 9 0.30 0.86520 0.87422 0.85620 0.00 10170.76
49 2010.02.09 00:00 modify 9 0.30 0.86520 0.87232 0.85620 0.00 10170.76
50 2010.02.09 07:39 s/l 9 0.30 0.87232 0.87232 0.85620 -216.42 9954.34
Fixed by:
17:53:44 2010.02.08 04:00 No SELL because getWpWS3Crossed.
And
17:53:44 2010.02.08 08:00 ADX M15 STRONG BUY
17:53:44 2010.02.08 08:00 ADX H4 SELLING
17:53:44 2010.02.08 08:00 Setting H4ZzReversingUp to 1
========================================================================
Late entry:
71 2010.02.22 07:31 buy 12 0.30 0.90062 0.00000 0.00000 0.00 10382.14
72 2010.02.22 07:31 modify 12 0.30 0.90062 0.88790 0.90954 0.00 10382.14
73 2010.02.23 00:00 modify 12 0.30 0.90062 0.89162 0.90954 0.00 10382.14
74 2010.02.23 07:30 modify 12 0.30 0.90062 0.90062 0.90954 0.00 10382.14
75 2010.02.23 11:10 s/l 12 0.30 0.90062 0.90062 0.90954 0.60 10382.74
Fixed by better trend analysis:
17:53:49 2010.02.22 07:30 bTodayHasSlope: 0, bBreakD1OpenRepeated: 0
17:53:49 2010.02.22 07:45 ADX M15 SELLING
========================================================================
Bad entry:
76 2010.02.23 21:48 buy 13 0.30 0.89122 0.00000 0.00000 0.00 10382.74
77 2010.02.23 21:48 modify 13 0.30 0.89122 0.88222 0.90004 0.00 10382.74
78 2010.02.24 00:00 modify 13 0.30 0.89122 0.88352 0.90004 0.00 10382.74
79 2010.02.25 00:00 modify 13 0.30 0.89122 0.88532 0.90004 0.00 10382.74
80 2010.02.25 13:33 s/l 13 0.30 0.88532 0.88532 0.90004 -174.60 10208.14
Fixed by better trend analysis:
17:53:49 2010.02.23 21:45 bTodayHasSlope: 0, bBreakD1OpenRepeated: 0