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

Zigzag Bollinger Band
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3237
Page 26 of 28
Author:  snailbeard [ Tue Nov 11, 2014 5:41 am ]
Post subject:  AUDJPY - going nowhere fast?

I was looking at the live naked M15 AUDJPY chart just now and seeing that price was moving up and wondered if there was an opportunity to jump in. To get a quick gauge of the possibilities I zoomed out to the weekly bars and found the support/resistance levels and added the Fibonacci indicator. This is one of the best indicators as it puts very little stress on MetaCrap compared to some of the heavy indicators in my usual template.

This is the weekly view:
AUDJPY-W1-Fibonacci-view-11Nov2014.png
On this scale it looks like long-term price is bumping against strong resistance and this is confirmed by the previous candle which has a long pin above the close. If we have enough confidence in the Fibonacci levels it is not necessary to look at anything else, but my dream of a super-simple recursive Fibonacci robot still remains a distant idea while I keep hacking at ZzBb...

Sometimes the weekly view is too course to tell how many pips are left before bumping into support so finding the next set of inner Fibonacci levels gives a better idea (yellow) and now we can zoom in to M15:
AUDJPY-M15-Fibonacci-outlook-2014-11-11-0400.png
At this level I try to add another set of Fibonacci lines and we can see the momentum of price changing more rapidly but will it crash through strong resistance or bounce back down? One could either go for the short trade to the next level or take the plunge for the long term using a sharp exit on rejection at resistance.

On a thin-spread broker the cost of getting in and out of a short trade can make it worth while in addition the large positive swap of buying helps.

However if our broker is offering fat-spreads and very little swap on a platform that frequently crashes then perhaps the short trade is not practical. For example, this next chart is from fat-spread Alpari and shows a high spread to get in and out of a trade:
AUDJPY-M15-Fat-Spread-Alpari-2014-11-11.png
Author:  snailbeard [ Tue Nov 11, 2014 6:43 am ]
Post subject:  ZzBb3 and AUDJPY

In September AUDJPY had a definite but slow drift downwards. The latest ZzBb3 did not enter a single trade for the whole month. The H4 chart shows that we could enter based on confirmed breaks of the Fibonacci levels. However, the retracements can bite and it requires about 70 pips of freedom to ride some of the pullbacks!

Nevertheless, the 12th of September shows a convincing break below the Fibonacci so why is ZzBb holding back?
audjpy-H4-break-Fibonacci-12-Sept-2014.png
Author:  snailbeard [ Tue Nov 11, 2014 12:16 pm ]
Post subject:  AUDJPY (double) trade of the day?

This update on AUDJPY shows that momentum continued, price motored through long term resistance which turned into support and suggested a repeat entry after bouncing off support between 11 and 12. A great trade for those who took the plunge. I haven't looked at any other charts today, however, since it offered a second bite at lunch time it gets my vote for best pair of the day:
AUDJPY-trade-of-the-day-11Nov14.png
Author:  snailbeard [ Wed Nov 12, 2014 11:12 am ]
Post subject:  When is a trend not a trend

After reworking several entry filters to allow more trades through then back testing on AUDJPY and USDCHF, there were quite a few extra entries when the daily bars weren't moving that much. It is quite straight forward to filter these out but there is also a good chance of filtering out the breakouts as well, because of the lagging nature of MAs.

In this chart the fast exponential moving average goes flat several times and there are days when it is just safer not to trade. ZzBb does really well on the trending part of the chart.
audjpy-D1-ExpMa-filter-Sept-to-Nov-2014.png
Before Ema filtering the back-test results include a lot of invalid entries:
audjpy-graph-mixed-results-when-no-slope.png
Although AUDJPY results are greatly improved by some tweaking of the slope filters the results may not be so good for every pair, however we see an almost doubling of profit by sitting out resting days:
audjpy-reduced-losses-by-ema-slope-filter-12Nov2014.png
I am not a great fan of using MAs for filters as the lagging aspect can often be more harmful than useful,
however, it seems to have done the job in this particular case. A better approach might be to make more use of the candle stickiness and shrinkage measurements.
Author:  snailbeard [ Fri Nov 14, 2014 10:53 am ]
Post subject:  Recovery of lost trades

I have spent most of this week recovering lost trades. Experimenting with different entry filters and making them more accurate and override-able by other criteria. I spent a couple of days trying to get USDCHF to make sense but the erratic reversals are too wild for this robot. This does highlight the folly of trading multiple pairs from a single instance of an EA. After studying recent USDCHF behaviour I see entry methods based on Fibonacci pull-backs but for the moment I have gone back to simpler pairs like GBPUSD.

From this extract from a previous forward-test it is apparent that a lot of potential trades were lost between these two dates:

Code: Select all

6	2014.09.04 14:54	modify	2	0.14	1.64592	1.64592	1.6393	0	10084.02
7	2014.09.04 18:04	t/p	2	0.14	1.6393	1.64592	1.6393	89.99	10174.01
8	2014.09.24 19:46	sell	3	0.18	1.63391	0	0	0	10174.01
9	2014.09.24 19:46	modify	3	0.18	1.63391	1.63979	1.62879	0	10174.01
10	2014.09.25 09:50	close	3	0.18	1.62884	1.63979	1.62879	87.8	10261.81
[/size]

From this long term view we can see that September was a pull-back in a long term fall:
GBPUSD-D1-long-term-fall-Jul-Oct-2014.png
After several days work I was able to recover the following 3 trades

Code: Select all

10	2014.09.05 14:31	sell	4	0.39	1.63094	0.00000	0.00000	0.00	10233.08
11	2014.09.05 14:31	modify	4	0.39	1.63094	1.63358	1.62860	0.00	10233.08
12	2014.09.05 15:05	close	4	0.39	1.62947	1.63358	1.62860	55.04	  10288.13
13	2014.09.16 08:01	sell	5	0.41	1.62149	0.00000	0.00000	0.00	10288.13
14	2014.09.16 08:01	modify	5	0.41	1.62149	1.62415	1.61934	0.00	10288.13
15	2014.09.16 09:45	close	5	0.41	1.61947	1.62415	1.61934	80.43	  10368.56
16	2014.09.17 11:03	buy	6	0.37	1.63138	0.00000	0.00000	0.00	10368.56
17	2014.09.17 11:03	modify	6	0.37	1.63138	1.62831	1.63367	0.00	10368.56
18	2014.09.17 15:35	close	6	0.37	1.63342	1.62831	1.63367	73.31  10441.87
[/size]

However, the one on the 18th was proving a lot harder to determine the correct intra-day direction and several factors were against entering such as the previous Doji candle. However a significant D1 ORFB cancels the D1 Doji.

After studying the following chart I reworked several filters to correctly determine price moving from low to high after a significant pull-back:
trade-recovery-gbpusd-M15-18Sept14.png
My preferred entry would occur somewhere between 10:45 and 11:15.

However, the detected entry occurs at 09:46 and requires a significant stop-loss to avoid a stop-out:

Code: Select all

19	2014.09.18 09:46	buy	7	0.23	1.63062	0.00000	0.00000	0.00	10441.87
20	2014.09.18 09:46	modify	7	0.23	1.63062	1.62578	1.63433	0.00	10441.87
21	2014.09.18 14:03	close	7	0.23	1.63316	1.62578	1.63433	57.07	10498.93
[/size]

The stops are dynamic based on ATR which reduces the risk of a stop-out but the risk-to-reward ratio is not satisfactory, this is partly due to trailing profit lock which reduces losses but increases the risk-to-reward ratio.

A close look at this trade reveals how it unfolds:

Code: Select all

19	2014.09.18 09:46	buy	7	0.23	1.63062	0.00000	0.00000	0.00	10441.87
20	2014.09.18 09:46	modify	7	0.23	1.63062	1.62578	1.63433	0.00	10441.87
21	2014.09.18 14:03	close	7	0.23	1.63316	1.62578	1.63433	57.07	10498.93

Price: 1.63026, SL: 1.62578, TP: 1.63433

Initial Price, SL & TP
1.63026-1.62578 = 0.00448 ~ 45 pips
1.63026-1.63433 = 0.00407 ~ 41 pips
[/size]

The trade already starts off with a slight handicap, which would be worse on a fat-spread broker. Lets add another 3 pips at each end and that would be 45-to-35 for a fat-spread broker.

The profit tracking reveals a modest cost to get in:

Code: Select all

09:47 GBPUSD: :  7  $MxPf:0.00  $RPf: -6.64  Pips:-1.30  $DdBp:-6.64  $DdAp:0.00  GapTp:38.40  MnGpTp:37.10
[/size]

and by 10:21 we are deep in the red and heading uncomfortably close to the stop-loss

Code: Select all

10:21 GBPUSD: :  7  $MxPf:0.00  $RPf: -89.90  Pips:-37.50  $DdBp:-89.90  $DdAp:0.00  GapTp:74.60  MnGpTp:37.10
[/size]

However, ZzBb has the correct intra-day direction and things turned around and started moving in a positive direction at 14:00 price moves very close to the target but has not quite reached it:

Code: Select all

14:00 GBPUSD: :  7  $MxPf:73.40  $RPf: 73.40  Pips:33.50  $DdBp:-89.90  $DdAp:-22.51  GapTp:3.60  MnGpTp:3.60
[/size]

Hold or Bail?
GBPUSD-M15-Hold-or-Bail-near-target-1440-18Sep2014.png
No emotions at this point just logic:

Code: Select all

14:03 GBPUSD: :  About to call setExitByExtraProfitLock()
14:03 GBPUSD: :  7  $MxPf:73.40  $RPf: 57.07  Pips:26.40  $DdBp:-89.90  $DdAp:-22.51  GapTp:10.70  MnGpTp:3.60
14:03 GBPUSD: :  7  $MxPf:73.40  $RPf: 57.07  Pips:26.40  $DdBp:-89.90  $DdAp:-22.51  GapTp:10.70  MnGpTp:3.60
14:03 GBPUSD: M1 :  updateStopLossToXplSl(): , bBuyoldSlGtNewSl: 0, bSelloldSlLtNewSl: 0
14:03 GBPUSD: :  7  $MxPf:73.40  $RPf: 57.07  Pips:26.40  $DdBp:-89.90  $DdAp:-22.51  GapTp:10.70  MnGpTp:3.60
14:03 GBPUSD: :  manageExits():  ExitByExtraProfitLock
[/size]

So in this case ZzBB sacrificed almost 11 pips in order to hold on to 26 pips and it is a significant proportion to give up.
Since this affects the risk-to-reward ratio we must consider whether or not it is being used appropriately.

Hindsight reveals the future-past:
Hindsight-shows-no-need-profit-locking-18Sept2014.png
Author:  snailbeard [ Sun Nov 16, 2014 7:16 am ]
Post subject:  Fibonacci blues

The Fibonacci levels are one of the most predictive indicators of range and direction. Often ZzBb correctly calculates these levels and makes the right decision. However, there are times when there is a more appropriate set of levels from a higher time-frame or longer period of time. One can visually determine which is the most appropriate set by counting the number of times price stops at different levels.

Often the Fibonacci levels from the past week are relevant to the current week but in this example we see that ZzBb is tricked into thinking there could be a breakout:

In the previous week W(-1) note the last two bars are large moves and Friday is the largest and a dominant reverse possibly indicating a longer reverse. Consider W(0) to be the current week and 23rd the current day and ZzBb ignores most of the day because of last weeks reverse. However, on passing 38.2 it calculates that price has cleared significant resistance, but these Fibonacci levels are the wrong ones so the outcome is a bad entry. With hindsight we can see that price is held in range before the real breaking out in the opposite direction:
gbpusd-d1-fibonacci-blues-Sept2014.png
After looking at the levels further in the past it was possible to determine the correct Fibonacci reference price which W(-1) failed to reach just a little higher than the highest bar. When we use this level it is correlated to the open and close of the last two bars of W(-1). So we know it is a better reference level we count more open, close, high and lows coinciding with each Fibonacci level.

Here is what ZzBb would have had to work with if it had deduced the correct Fibonacci levels:
gbpusd-d1-corrected-fibonacci-levels-Sept2014.png
The correct levels would affect the timing of entries and possibly avoid a bad entry or perhaps just delay it.

The real clue here is the relative strengths of previous price fall and the current price rise. I implemented an asymmetric price momentum filter to cancel weak breakouts, however I have not used it enough to know how reliable it is:
gbpusd-d1-asymmetric-price-momentum-Sept2014.png
Author:  snailbeard [ Fri Nov 21, 2014 2:19 pm ]
Post subject:  ZzBb4 Final

This is the final version of ZzBb :party:

I use the word final in a somewhat flexible manner since we are talking about markets that change over time, but I am hoping that the main body of work is stable enough not to require major rework.

It was very satisfying to see ZzBb riding over bumpy swings (GBPUSD) with patience waiting for high probability trades.
A significant challenge is adjusting stop-losses and targets as price swings get bigger.

Also the name no longer makes sense now that it is a collection of multiple layers of analysis, so I think a better name might be MishMash or Omnibus. However for convenience I'll just refer to to this EA as ZB4 from now on.

This is not totally automatic and there is still more work to do on automatically getting the right range for stop-losses. For the time being there is a setting to switch from a smaller stop-loss range to a bigger stop-loss range. However, this is a global setting rather than pair by pair. The same settings are not always appropriate for different pairs and this weeks setting might need to be different from last weeks.

Here is what happens when running USDJPY with the same setting as GBPUSD:
usdjpy-backtest-with-tight-sl-2014-11-21.png
Now giving USDJPY the correct range setting according to the size of reversals:
USDJPY-backtest-with-D1-ATR-SL-2014-11-21-1228.png
So with the wrong setting we get too many stop-outs and with the correct range we get a dramatic improvement in profit factor, which has gone from 1.45 to 7.5 and the draw-down has gone down to 2%.

So my next task is to automate the stop-loss range adjustment based on recent pull-backs.

Although I haven't talked about it much, an important contribution to avoiding stop hits is a deep look at the candle patterns before entering a trade. There is a lot of information in the arrangement of candles on different time frames: combining this information has been a significant factor in achieving a high win to loss ratio!
Author:  snailbeard [ Fri Nov 21, 2014 3:28 pm ]
Post subject:  GBPUSD stop loss settings

Following on from USDJPY stop-loss setting: GBPUSD needs the smaller range setting:
GBPUSD-better-results-with-smaller-stops-21Nov2014.png
And next with the wider stop-loss GPBUSD results are erratic:
GBPUSD-poor-results-with-wider-stops-21Nov2014.png
Author:  snailbeard [ Sun Nov 23, 2014 6:13 am ]
Post subject:  EURUSD (ADX & longer stops)

EURUSD continues to resist making profits for any of the stop-loss ranges, although the longer stops result in some profitable trades:
EURUSD-mixed-results-with-longer-stops-2014-11-21.png
After spending more time looking at EURUSD I noticed that there is an issue with short term reversals which are often too short and lead to late entries. To avoid this it is only necessary to trade with the longer term direction using the ADX filter and longer stops. Although, we often describe these indicators as too lagging, there are occasions when they produce the correct information.
eurusd-results-with-ADX-and-longer-stops-2014-11-23 05.png
Although, ZB4 is not finding enough entries, at least it is now worth trading EURUSD. More work is required to increase the number of trades.
Author:  snailbeard [ Wed Dec 03, 2014 5:25 pm ]
Post subject:  Holy MetaCrap

The idea of automated trading is to achieve repeatable success by repeatedly applying a set rules which generally produce a similar outcome. This has often been difficult and this is one of the reasons I gave up working on earlier EAs. One significant requirement is that the results should not vary too much across different brokers. To avoid this trap I back-test and forward test on several brokers. Often the best results come from GlobalPrime but broker data seems to be as fickle as the market sometimes.

Today the carpet has been pulled from under my feet because GlobalPrime and FxOpen are giving totally opposite results. In the past, timezones and pivots created big differences between different brokers so it made sense to use brokers with the same server times. GP and FxOpen have the save server times. A quick side by side comparison of H1 bars looks the same and less than a pip difference at the highs and lows.

Nevertheless, something is different and just one changed parameter is enough to turn winners into losers.

In this example we have two similar entry times but with opposite outcomes:
FxOpen:

Code: Select all

13	2014.10.02 13:56	sell	5	0.26	1.61449	0.00000	0.00000	0.00	10319.93
14	2014.10.02 13:56	modify	5	0.26	1.61449	1.61867	1.61067	0.00	10319.93
15	2014.10.03 10:38	t/p	5	0.26	1.61067	1.61867	1.61067	97.17	10417.11
[/size]

GlobalPrime:

Code: Select all

25	2014.10.02 13:45	sell	9	0.34	1.61465	0.00000	0.00000	0.00	9938.08
26	2014.10.02 13:45	modify	9	0.34	1.61465	1.61755	1.61203	0.00	9938.08
27	2014.10.02 16:16	s/l	9	0.34	1.61755	1.61755	1.61203	-63.34	9874.74
[/size]

This kind of result is usually due to a stop-loss being too close to the entry price. We can see from that entry prices are less than 2 pips different but the stop-losses are more like 10 pips different which is enough to skew the results.

A fixed stop-loss would not result in this difference so something about the dynamic range adjustment is affected by data derived from prices, which in other respects appears to be quite similar.

At least I now know where to look...

After a bit more detective work and now knowing where to look in the log files, there is another clue in the adjustment of stop-losses:

Code: Select all

13:45 GBPUSD: :  Max SL changed: Now: 1.61877, Was: 1.61892; ---> 0.00418
13:45 GBPUSD: :  Max TP changed: Now: 1.61077, Was: 1.61100;

13:46 GBPUSD: M1 :  Using P% ofH4Atr for TP/SL: 0.00261

13:45 GBPUSD: M1 PACL: Setup VPO by  PALC Dp method  Dir: -1 At: 1.61476
13:45 GBPUSD: :  VPO: Pair: GBPUSD, bActive: 0, Sell, Lots: 0.340, Price: 1.61466, SL: 1.61755, TP: 1.61203, MTPT: 0, TS: 2014.10.02 13:45, TE: 2014.10.02 14:00
13:45 GBPUSD: :  bVpoHasBeenTriggered
13:45 GBPUSD: :   Sell, Sz: 0.340, Pc: 1.61475, 
Sl: 1.61755, ---> 28.9
[/size]

We see that: 'Using P% ofH4Atr for TP/SL' has reduced the stop loss but this doesn't happen on FxOpen only on GP.

If you have read the earlier posts then you'll understand how crucial estimating the correct range for target and stop-loss is to the optimum performance and overall net profit. The calculation and adjustment of stops has become a little too baroque and requires some streamlining along with improved logging so it is clear which adjustments are being invoked and perhaps some of those adjustments should be part of the user settings.
All times are UTC Page 26 of 28