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

Zigzag Bollinger Band
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3237
Page 14 of 28
Author:  snailbeard [ Sat Mar 29, 2014 10:31 am ]
Post subject:  Buy only backtest

The buy only backtest results are still not as good as the Sell only results,
but they are improving:

Code: Select all

Bug fixes, plus tweaks to interpretation of Doji candles

1	2012.06.04 17:52	buy	1	0.30	0.97132	0.00000	0.00000	0.00	10000.00
2	2012.06.04 17:52	modify	1	0.30	0.97132	0.96814	0.97414	0.00	10000.00
3	2012.06.04 23:58	t/p	1	0.30	0.97414	0.96814	0.97414	84.60	10084.60
4	2012.06.05 01:31	buy	2	0.10	0.97622	0.00000	0.00000	0.00	10084.60
5	2012.06.05 01:31	modify	2	0.10	0.97622	0.96954	0.97994	0.00	10084.60
6	2012.06.05 06:05	t/p	2	0.10	0.97994	0.96954	0.97994	37.20	10121.80
7	2012.06.06 18:48	buy	3	0.10	0.99092	0.00000	0.00000	0.00	10121.80
8	2012.06.06 18:48	modify	3	0.10	0.99092	0.98294	0.99654	0.00	10121.80
9	2012.06.07 01:59	t/p	3	0.10	0.99654	0.98294	0.99654	56.80	10178.60
10	2012.06.07 09:02	buy	4	0.10	0.99492	0.00000	0.00000	0.00	10178.60
11	2012.06.07 09:02	modify	4	0.10	0.99492	0.98034	1.00344	0.00	10178.60
12	2012.06.15 08:15	t/p	4	0.10	1.00344	0.98034	1.00344	86.80	10265.40
13	2012.06.20 06:51	buy	5	0.10	1.01932	0.00000	0.00000	0.00	10265.40
14	2012.06.20 06:51	modify	5	0.10	1.01932	1.01084	2.03844	0.00	10265.40
15	2012.06.21 15:05	s/l	5	0.10	1.01084	1.01084	2.03844	-84.20	10181.20
16	2012.06.26 06:16	buy	6	0.30	1.00332	0.00000	0.00000	0.00	10181.20
17	2012.06.26 06:16	modify	6	0.30	1.00332	1.00004	1.00554	0.00	10181.20
18	2012.06.26 08:06	t/p	6	0.30	1.00554	1.00004	1.00554	66.60	10247.80
19	2012.06.27 00:49	buy	7	0.20	1.00492	0.00000	0.00000	0.00	10247.80
20	2012.06.27 00:49	modify	7	0.20	1.00492	0.99984	1.01134	0.00	10247.80
21	2012.06.28 00:34	t/p	7	0.20	1.01134	0.99984	1.01134	129.60	10377.40
Author:  snailbeard [ Mon Mar 31, 2014 7:52 am ]
Post subject:  Supernode reversals

There are a couple of patterns which come up reliably at the end of a major swing. This is a swing which could be called a trend because it might have been running strong for a month or two. However, at some point macro economic forces start to indicate that traders have taken the price too far in one direction.

The Fibonacci levels, the weekly pivots, the zig zags and Bollinger bands make it straight forward to spot the reversal patterns:

On the daily chart we have a 'supernode' where a D1 Zigzag occurs sharply below the D1 Bollinger Band. The strong D1 Doji has a long tail spanning several significant levels. Then in the following days we get strong support at weekly pivot S1. I need to add this to the EA so it doesn't keep looking for sell entries.
Author:  snailbeard [ Mon Mar 31, 2014 8:14 am ]
Post subject:  Strong H4 reversal pattern

Following on from the daily bars to a H4 bar chart: we get a similar pattern. The EA has enough information to actually determine a buy entry but it would involve tuning off too many anti-buy checks that it might not be worth the risk of adding new bugs.

Just as before we have a Doji, but with a longer body, so it might not count as Doji depending on how the EA thresholds body length to tail ratio. However, the tail alone crosses several levels which is important.
Two other things to take note of:
a) The H4 bars never close below WS1.
b) The H4 bars close inside the Bollinger band.
Author:  snailbeard [ Mon Mar 31, 2014 3:24 pm ]
Post subject:  Both Buy and Sell trades enabled again

After a few more tweaks and the D1 Zigzag-Doji reversal check, I now get similar results for both Buy and Sell trades. Actually 5 Buys and only 3 sells. Once again the tuning process has whittled away at the good trades as well as the bad entries. To compensate for this I need to add more entry patterns and reentry patterns or extend the take profit range:
Author:  Radar [ Mon Mar 31, 2014 3:57 pm ]
Post subject:  Zigzag Bollinger Band

Hey SnailBeard,

Just wondering if it's time to start looking at scale-ins, either based on returning to the trend after a retracement, or based on a fixed pipstep (anti-gridding)?

That will help make up for the trades that are filtered out.

I have some v509 code that checks locked-in profit, and starts scaling-in when there's enough locked in to cover the potential loss of the scale-in. It will double-up when there's enough profit to cover that potential loss as well. Just yell if you're interested ;)

Have fun!

Radar =8^)
Author:  snailbeard [ Mon Mar 31, 2014 4:31 pm ]
Post subject:  Leaving the Twilight Zone

In NanningBob's forum I read a lot about trending and ranging. NB gave a very thoughtful explanation on how to identify a currency as ranging. There is a good example of ranging on the H4 chart at the D1 reversal supernode. I was a bit slack in my implementation of this filter because it was taking out the buy trade on the 4th June which is beyond the ranging zone. For convenience, I identify the ranging zone as a price range between two Fibonacci price levels (or weekly pivots).

I have now recovered this winning trade but there could be other cases of filters taking out perfectly good trades.
Author:  snailbeard [ Mon Mar 31, 2014 4:50 pm ]
Post subject:  Zigzag Bollinger Band

Radar ยป Mon Mar 31, 2014 3:57 pm wrote:Hey SnailBeard,

Just wondering if it's time to start looking at scale-ins, either based on returning to the trend after a retracement, or based on a fixed pipstep (anti-gridding)?

That will help make up for the trades that are filtered out.

I have some v509 code that checks locked-in profit, and starts scaling-in when there's enough locked in to cover the potential loss of the scale-in. It will double-up when there's enough profit to cover that potential loss as well. Just yell if you're interested ;)

Have fun!

Radar =8^)
Hi Radar!

That sounds very interesting. I am not sure it would work with my 'API' and filters. I also wonder if I might hit another 509 limit. I am getting to the point now where I would like to stop adding things so that I could start thinking about developing in a proper programming language!

I have been making notes of some compatible rentry methods as I discover them.
Author:  snailbeard [ Mon Apr 14, 2014 5:56 pm ]
Post subject:  Mad dog chases tail

I have been chasing my tail, trying to find a way to run zzbb on Empty4 build 625. Lots of bad things were revealed by the 'improved' compiler and after spending days going through hundreds of errors and warnings, I finally had a compiled version that was ready to run on the current version. Unfortunately, that was not enough pain there was more to come:
MetaHell opened up and swallowed the old libs - refusing to use them or even admit they existed!
So I had to do a bit more work on the libs too. Can't even get old libs to be seen by old ex4s!

On running the new improved zzbb it was surprising (not really) that something was still broken and it turned out that ArraySize() called inside a function for a two dimesional array seems to be broken in the 625 compiler.
See the coders forum for the example code which reveals it.

Can't go forwards, can't go backwards - definitely stuck in MetaHell!

Finally, carefully taking the 625 version of the source back to the 509 compiler and sucking in the library code to one big file there is an ex4 file which runs on both MetaCrap 509 and 625, although I need a different top-level file for each compiler.

Anyway, I am now able to do back-testing and forward testing on the latest MetaCrap.

It seems that there is always 'one more bug' to fix and unfortunately there are several not one...
Author:  snailbeard [ Mon Apr 14, 2014 6:14 pm ]
Post subject:  Raining cats and Dojis

I thought I had tested the Doji code enough but perhaps I hadn't bothered to calculate the previous days Doji, but in the attached chart the previous days Doji candle is a bad omen, there are several signs but mostly apparent on H4, but this D1 Doji does not show up in the log:

Code: Select all

checkD1ZzDoji():
, iDirection 1
, iD1DojiCount 0
, st_iD1ZzBackBarFirst 4
, bD1ZzDoji 0
In the EA a failing trade is triggered on the M15 timeframe, despite the D1 Doji:
(Vertical red line on the 25 Feb 2014)
It is further highlighted by its membership of a M formation and it is the second or third touch of an invisible resistance at the yellow dashed line.
There is an additional clue, which was the D1 ZZ peak was outside the D1 Bollinger band and the candles are closing further away from the upper band:
Author:  snailbeard [ Wed Apr 16, 2014 10:49 am ]
Post subject:  Jumping the gun

There are often winnable trades in both directions, which is why some traders are experts in hedging.
I have tried it a few times to try and reduce losses but it was reactionary rather then intellectual.
So if you are confident enough you might trade with large stop-losses, but this has its drawbacks in multi-pair trading where each pair adds to drawdown and so zzbb suffers from the opposite problem of having a tight stop-loss which means good timing is important. It is not just a matter of determining that price is going to go with the long term trend, zzbb needs hold back until a pull-back has completed. Although it can't get right all the time the behaviour of H4 bars with respect to the appropriate Fibonaccis levels is often consistent.

I have cases where premature entries are almost caught but not quite. The problem is due to using a fixed threshold. Whenever I guess a value and put a number staight in the code I know that I'll be revisiting that code in the future. So now it is time to add a bit of dynamism. A simple linear ratio in a non-linear system might give unexpected results some of the time, but generally an adaptive system should never use any constant values it should be data driven.

So in the daily outlook D1 bar chart for EURUSD, we see retrospectively that on 4th March 2014 there was badly timed buy entry. Looking at the previous day's reverse-hammer candle in relation to a significant Fibonacci level suggests that some traders are pushing to go higher while a majority are not ready to go higher,
so we need to bide our time a while until we get confirmation that price is ready to rejoin the main swing.
All times are UTC Page 14 of 28