stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Zigzag Bollinger Band
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3237
Page 19 of 28
Author:  snailbeard [ Thu Jun 19, 2014 6:02 pm ]
Post subject:  Successful price action trade

Price Action Cross Weekly Pivot (PAXWP)

With reference to the previous post, I have fixed the problem with the W1 Fibonacci filter. However, T3a is still not a valid entry because the price has already moved too far to enter a new trade. Therefore, the filter for T3a is doing the correct thing. However, I have added a price-action trigger conditional on a weekly pivot cross, which works well for this example but needs more testing over a lot more data. This is currently a bit slow to enter because the check is restricted to the M15 bar open event. At some point I should convert it to a Virtual-Pending-Order at, say, 5 or 10 pips beyond WP, which would grab an extra 15 to 10 pips respectively.

Looking at the breadcrumbs for the PAXWP over a long period we could count the number of trades triggered by this method:

Code: Select all

checkPriceActionWpCrossed(): , iDirection: 1, bPriceCloseToWp: 1
, bPriceDirectionUp: 1, bPriceDirectionDown: 0
, bPriceRightSideOfWp: 1, bPriceActionOk: 1, bWpPriceActionOk: 1
, iWPivotIdx: 8, strWpName: R1
So the third entry, when combined with breakeven and trailing stoploss methods produces less profit than letting the trade run to TP, so there is always scope for a significant improvement in profit, since hitting the trailing stops is costing up to 30% of the profit and the targets are already pessimistic. However, it is easy to say that when the market has a well established direction.

At least ZzBb is finding an entry for T3 even if the profit is lot less than its potential

Code: Select all

32	2012.01.25 17:33	buy	4	0.30	1.05212	0.00000	0.00000	0.00	10426.90
33	2012.01.25 17:33	modify	4	0.30	1.05212	1.04280	1.05994	0.00	10426.90
34	2012.01.25 18:05	modify	4	0.30	1.05212	1.05212	1.05994	0.00	10426.90
35	2012.01.25 18:16	modify	4	0.30	1.05212	1.05832	1.05994	0.00	10426.90
36	2012.01.25 18:17	modify	4	0.30	1.05212	1.05212	1.05994	0.00	10426.90
37	2012.01.25 18:18	modify	4	0.30	1.05212	1.05832	1.05994	0.00	10426.90
38	2012.01.25 18:19	s/l	4	0.30	1.05832	1.05832	1.05994	186.00	10612.90
Author:  snailbeard [ Sat Jun 21, 2014 9:27 am ]
Post subject:  Improving D1 ORFB

Now that the results from the work on the daily direction seem more reliable, it is time to improve the entry methods.

In this chart, there are a number ways to trigger a trade, firstly there is the original M15-Zigzag method and a crossing of the M15 Mid-Bollinger band. There is also a reimplemented version of the M15-Zigzag which is less prone to the zigzag false-pivot issue. In the log dump we see old zigzag method giving the opposite message while everything else flags a buy trade:

Code: Select all

2010.01.04 04:15  : Alert: AUDUSD:   bZzM15PentaH4Triplet && (iZzM15H4TripletDir < 0)
2010.01.04 04:15  : Alert: AUDUSD:  ZZGoodForSell bCloseAtM15MBB && bM15H4TriggerConfirmed
//--------------
2010.01.04 04:15  : getY1D0HasSlope(): iY1D0Direction: 1
2010.01.04 04:15  : bwaReEntry (bHasIntraDaySlope == true)
2010.01.04 04:15  : getMtfCandleEntry(): iTimeSpanInMinutes: 120, iMtfCandleBias: 1
2010.01.04 04:15  :  UseCandleReEntry: bValidMiniPullback: 1
2010.01.04 04:15  : Trade because: M15ZzTriNodeBuy.
2010.01.04 04:15  : VPO: Pair: AUDUSD, bActive: 1,  Buy, Lots: 0.300, Price: 0.89674, SL: 0.89374, TP: 0.90574, MTPT: 0, TS: 2010.01.04 04:15, TE: 2010.01.04 04:30
//--------------
2010.01.04 04:18  : bVpoHasBeenTriggered
2010.01.04 04:18  : VPO: Using JD1SL: 0.88792
2010.01.04 04:18  : open #1 buy 0.30 AUDUSD at 0.89692 ok
2010.01.04 04:18  : Attempted modify of #1 price:0.00000000 sl:0.88792000 tp:0.90574000
2010.01.04 04:18  : modify #1 buy 0.30 AUDUSD at 0.89692 sl: 0.88792 tp: 0.90574 ok
Since the ZZ entry comes first we don't see the ORFB, which would not trigger until much later (05:30)
or even later if we have to wait for the crossing of a pivot or Fibo level. Both H4-ORFB and D1-ORFB might trigger at the same time or they might be given different constraints since D1-ORFB might require more price action to be valid.

ORFB (B) corresponds to a price-action triggered entry. The downside to this late entry is that we are in prime-time market hours, not only have we missed quite a few pips already but there is a danger of spread expansion, especially if running our trades through one of the criminal brokers.
Author:  snailbeard [ Sat Jun 28, 2014 5:54 am ]
Post subject:  Improved swing analysis

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

Author:  snailbeard [ Sat Jun 28, 2014 7:13 pm ]
Post subject:  3 Year simulation & comparison

After running a backtest over 3 years for AUDUSD, which contains some very wild behaviour for months at a time, I was surprised by the results, but this time in a positive way. It is the first time I have had a significant long term gain. With manual intervention the results could be much better or perhaps there are still some significant bugs to be discovered.

Going back to the previous 3 year backtest on exactly the same day 1 month ago, there was a small gain without manual intervention and some very long periods of losing trades:
AUDUSD-M1-3-year-backtest-balance-curve-run28May2014.png
Now comparing this to the latest results, there is a significant reduction in the number of bad trades, the long term profit ratio has gone up to 1.8, and the win ratio has gone up to 75%.
AUDUSD-M1-3-year-backtest-run28Jun2014.png
So there is the question of what to do next. If there were no correlations between currencies then the barren periods would not be an issue, however, if other currencies produced similar wins and losses at the same time this would amplify the curve, great in the winning periods but scary in the losing periods, imagine the psychological aspect of running something for three months and not seeing anything positive. It would be easy to lable the EA as useless and abandon it.

If I could identify about 10 unrelated items to trade in parallel then I would be very happy with these results.
Author:  snailbeard [ Mon Jul 07, 2014 7:08 am ]
Post subject:  win some lose some

End of swing reversals/pull backs are now the greatest source of losses.

In this backtest there is a successful trade followed by a reentry into the same swing, but the reentry is too late (or too soon - since the overall direction is still correct). There are several clues in the chart that we can take into account:
1. Price recently made a zigzag top and price is below the top
2. Price has recently covered 190 pips
3. Price recently swung across two pivot levels
4. The previous candle range was less than the previous-previous candle range
5. The ZZ top is outside the H4 Bollinger band and the previous candle was completely inside the Bollinger

None of these signs are concrete but they often indicate that price is ranging or pulling back.

The loss is significantly more than the gain:

Code: Select all

150	2010.07.13 15:42	s/l	14	0.40	0.88194	0.88194	0.88374	284.80	11874.00
--------------------------------------------------------------------------------------------------------------
154	2010.07.16 13:57	s/l	15	0.40	0.87252	0.87252	0.89224	-428.80	11445.20
Author:  snailbeard [ Mon Jul 07, 2014 9:20 am ]
Post subject:  M15 view inculding ADX & ATR

I have found that ADX and ATR suffer the same problems as most lagging indicators because market behaviour can vary so much any absolute threshold works some of the time. However, we might have more luck with relative changes or normalised changes.

In the following M15 chart: looking at the current ATR and ADX values relative to the most recent H4 zigzag low and high is more consistent with the current market sentiment than trying to pick absolute thresholds for confirmation of a trend.

So in this case the instant reading of ATR is little changed for either the good trade or the bad trade.
In the case for those using a simple ADX-Main threshold it appears that both entries are valid, but looking at the changes in ADX-Minus and ADX-Plus as well is more useful.
Author:  jlcgarcia [ Mon Jul 07, 2014 9:29 am ]
Post subject:  Zigzag Bollinger Band

Hi Snailbeard,


I have recolected your ideas in an EA that is in myfxbook called "PokerMontana".

Let's see.

Regards


José Luis
Author:  snailbeard [ Mon Jul 07, 2014 12:04 pm ]
Post subject:  Kill flags

It is easy to filter out losing trades, but howmany good trades might be lost as well?

The previous losing trade is easily trapped:

From the log file there are also a number of other flags hinting at a possible reversal or ranging, but nothing is ever concrete:

Code: Select all

2010.07.14 20:00
================
i3H4CandleBias: 0
bAdxM15Buy: 0, bAdxM15Sell: 1
PBRE Buy: bIgnoreD1Doji : 1
bZzD1ReversingDown: 1
Setting H4ZzReversingDown to 0

PBRE Buy entry dropped because bH4UpperH4BbBkIn
------------------------------------------------------------------------

20140707.log:33489: 12:27:28 2010.07.14 20:00 : PBRE Buy entry dropped because bH4UpperH4BbBkIn
20140707.log:33775: 12:27:28 2010.07.14 20:45 : PBRE Buy entry dropped because bH4UpperH4BbBkIn
Found 5 matches for "bH4UpperH4BbBkIn".

20140707.log:69935: 12:27:32 2010.07.23 20:00 : PBRE Buy: bIgnoreD1Doji : 1
20140707.log:70006: 12:27:32 2010.07.23 20:15 : PBRE Buy: bIgnoreD1Doji : 1
Found 314 matches for "PBRE Buy: bIgnoreD1Doji : 1".

20140707.log:34782: 12:27:28 2010.07.15 00:00 : PBRE Buy: bIgnoreD1Doji : 0
Found 34 matches for "PBRE Buy: bIgnoreD1Doji : 0".
Combining several flags gives more control over the final choice.
Note that AdxM15Sell flag is also true.
Author:  snailbeard [ Mon Jul 07, 2014 12:15 pm ]
Post subject:  Zigzag Bollinger Band

jlcgarcia » Mon Jul 07, 2014 9:29 am wrote:Hi Snailbeard,


I have recolected your ideas in an EA that is in myfxbook called "PokerMontana".

Let's see.

Regards

José Luis
Hi José,

I'm not sure how you did it, but it sounds very interesting, I look forwarding to seeing the outcome!
Meanwhile, I need to do another 3Y backtest to see what damage my latest changes have done to ZzBb.
Author:  snailbeard [ Tue Jul 08, 2014 2:11 pm ]
Post subject:  No trading zone

jlcgarcia » Mon Jul 07, 2014 9:29 am wrote:Hi Snailbeard,
I have recolected your ideas in an EA that is in myfxbook called "PokerMontana".
Let's see.
Regards
José Luis
I thought I should mention that the current medium term low price volatility is incompatible with many of the methods described here and used in ZzBb, which work better for W1 ATR > 300 pips. Or to express this in terms of weekly pivots:
if (WR1 - WS1) > 300 then prices are moving enough otherwise go to sleep

So this low volatility could go on for weeks or months, therefore, it might be more profitable if I spend my time on a daily pivot scraping method instead of the current multi-day setups.
All times are UTC Page 19 of 28