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

Zigzag Bollinger Band
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3237
Page 15 of 28
Author:  snailbeard [ Wed Apr 16, 2014 11:23 am ]
Post subject:  Jumping the gun

Following on from the D1 chart, on this H4 chart there is a H4 reverse-hammer candle which closes just below the weekly pivot and a significant Fibonacci line. The close below the line suggests only scalp or wait for confimration which comes at midday on the 6th March when the big boys decide they are going for it.

ZZBB should catch this event on M15 as a D1-Open 'break-higher-repeated' pattern or H4-Open 'break-higher-repeated' pattern. I'm intending to implement more entry variations on this theme.
Author:  snailbeard [ Fri Apr 18, 2014 10:40 am ]
Post subject:  Cautious Kate

Finally, a version possibly worth running on MetaCrap Build 625 with the two dimension ArraySize() problem and only empty silence from MetaCrap forum on this issue...

This version back ported to 509 compiler with forward compiler compatibity, has a lot of bug fixes and tweaks and some additional layers of predicate logic which all amounts to huge ball of spagetti. Vorsprung durch technique? Not without a rewrite! Yes there is a lot of scope for generalisation, polymorphism and templatization...

If it makes profits then I'll refer to it as Kiss me Kate, but for the time being Cautious Kate seems more appropriate as its very picky and not trading that much. I haven't really accomplished the original aim of frequent trading, but neither has it been a wasted journey despite being shipwrecked a few times by those dung beatles that we all know and love :lol:

The screen info is a little out of date and doesn't reflect its decision making process. That requires a visit to the log file: and 250 lines of Kates's internal ankst per update, takes a while to wade through. So plenty more to do. Is it time to revisit DLLs?
Author:  snailbeard [ Sat Apr 19, 2014 6:07 am ]
Post subject:  open-price-return-then-break (OPRTB)

This is a generic entry concept which can be applied on any time frame. Although it might not be reliable on its own it can be part of a confirmation stage. ZzBb puts a lot of analysis into determining the expected direction but the timing of entries is critical in relation to the stop-loss. The original method of entry was sometimes in conflict with the timing of confirmation of swing.

On a particular time frame a bar opens but goes in the reverse direction to the expected direction, after some time price moves back towards the open price, this might happen several times then a significant move occurs in the expected direction. In otherwords it breaks passed the open price by a sufficient margin.

The weakness in current entry methods is that in 15 minutes price sometimes moves enough to go outside the parameters of the entry method.

OPRTB complements other entry methods because it can be 'reloaded' and repeated as long as the the primary swing direction is 'enabled' and as long as end-of-range filters don't block it.

The same small amount of code can be reused for any timeframe and any parameters for minimum reverse, minimum time before enabling a VPO (Virtual Pending Order) and the minimum price margin required to confirm a break.
Author:  snailbeard [ Sat Apr 19, 2014 7:35 am ]
Post subject:  H4 view of Open Price Return Then break

Perhaps we should refer to this H4 chart first which provides a context for what is unfolding in the M15 chart.

We understand the downward bias immediately with candles hugging the lower green H4 Bollinger band, so we can immediately rule out a buy trade for the time being. The day opens just under a weekly pivot. Price moves up a little and a Doji hangs under the pivot line. The interesting action happens in next H4 bar. There needs to be one or two VPOs active which can be triggered by a tick passing the original open price of the current H4 candle by a margin, similarly for D1-Open if price returns to and passes the D1 open price there should be an entry.

A variation on an Open-return-break of the open H4 candle might be the same method applied to the previous bar. However, that would require additional constraints and the close of the previous bar is usually at the same price as the open price of the current bar except after holidays and significant events.

So just like we did in NB 10.4, we can anticipate our entries on the H4 time frame. Since I don't trust the market too be honest with pending orders, I set them up in memory and check the spread before converting them into direct market orders. This should help avoid problems with stop-losses and spread leeching.
Author:  snailbeard [ Mon Apr 21, 2014 7:39 am ]
Post subject:  Coder's challenge

Since we have been denied the chance of using interactive debugging for a long time, I have developed a way of spotting bugs through a style of programming which I never used before MetaCrap. It could be refered to as an audit trail for logic: Track the logic by creating intermediate flags which can be logged. I suppose you could call it bread-crumb debugging. Although I spend as a much time adding extra code for this as I do on the core logic it often bears fruit in the long run.

Can you spot the inconsistancy in this dump from an analysis of the M15 zigzag?

Code: Select all

, st_bM15ZZ_N1_AboveM15UBB 0
, st_bM15ZzTriNodeUp 1, st_bM15ZzTriNodeDown 0
, st_bM15ZZ_M15UBB_Bias 0, st_bM15ZZ_M15LBB_Bias 0
, st_bM15ZZ_M15StrongUp 0, st_bM15ZZ_M15StrongDown 1
, st_bM15ZZ_M15Up_Bias 0, st_bM15ZZ_M15Down_Bias 0
, st_iM15ZzPrevStepUp 0, st_iM15ZzPrevStepDown 1
, st_iM15ZzBbRangingUp 0, st_iM15ZzBbRangingDown 0
, st_bM15ZzTriNodeBuy 0, st_bM15ZzNoBuyFlag 1
, st_bM15ZzTriNodeSell 0, st_bM15ZzNoSellFlag 0
, st_bM15ZzContraction 0, st_bM15ZzBigContraction 0
, st_bM15ZzBiggerSwingC 0
, st_bM15ZZ_PlBkSwing 0, st_M15ZzSkipCount 0
, st_bM15ZzBreakPrevLow 1, st_bM15ZzBreakPrevHigh 0
, st_M15EntryH4BreakLower 0, st_M15EntryH4BreakHigh 0
, st_bM15ZzExhaustedDown 0, st_bM15ZzExhaustedUp 0
So now you can understand why each iteration can generate 250 lines of bread crumbs, if every function had it's debug trace flag turned on at the same time it would be like looking for a needle in a haystack, but fortunately good bread-crumbing reduces the search space for faults.

So you are probably wondering how st_bM15ZzTriNodeUp can be true when most flags are indicating a definite downward bias? Yes and you would be right. However, before I tell you how stupid this bug is:
Let he who is without this sin cast the first stone.

It is due to the programmer's curse, that dreaded lazy time saving behaviour known as cut, paste and change.
I try so hard to be consciously careful about this but howmany of our bugs track back to this action?

There are two major contributions to these errors
a) MQL lacked the language constructs: classes, polymorphism, generic templates
b) The buy/sell symmetry

We now have an escape root from the first restriction but the buy and sell symmetry always requires a yin for every yang. There is something we can do to reduce these slip-ups. I have two or three editors open and don't do the paste directly in the original, instead I copy snippets to other editors and finish the changes
outside the original and copy them back in afterwards. This does definitely help me to reduce my self- inflicted faults.

Of course the yang is a generic reverse of the yin so if we could spend some time thinking about that for a new piece of work, but it is too late for this one.

I have just thought about it and the simple solution would be to duplicate the price data stream and just invert the second stream,
so the code is doing buy only trades on say
a) eurusd
b) usdeur

Why didn't I think of that before :arrrg:
Author:  Sgt.Forex [ Mon Apr 21, 2014 8:42 am ]
Post subject:  Zigzag Bollinger Band

Hi snailbeard,
i like your concept of spotting trading opportunities, as well as your coding knowledge.
Your thread was and actually is nice to read! Keep it going!
Take care and good luck with the coding of your strategies!
:good:
Cheers
Philipp
Author:  snailbeard [ Tue Apr 22, 2014 5:02 am ]
Post subject:  Zigzag Bollinger Band

Sgt.Forex ยป Mon Apr 21, 2014 8:42 am wrote:Hi snailbeard,
i like your concept of spotting trading opportunities, as well as your coding knowledge.
Your thread was and actually is nice to read! Keep it going!
Take care and good luck with the coding of your strategies!
:good:
Cheers
Philipp
Thanks, I'll definitely keep posting if any of this is useful to others.

Brian
Author:  snailbeard [ Tue Apr 22, 2014 8:19 am ]
Post subject:  Examples of Open Price Reverse Then Break

Keeping in mind that these should only be taken if higher timeframes support them, we can easily identify several cases where the condition can be satisfied by appropriate parameters.

On the H4 chart there is a dead zone where we are not sure whether price is ranging or reversing. However, I have labelled some bars a,...e where I think OPRB might not get rejected by various filters. Other entry methods have not resulted in trades, possibly due to the strength of the move or over-restrictive entry filters.
Author:  snailbeard [ Tue Apr 22, 2014 8:46 am ]
Post subject:  M15 view of OPRB

On this M15 chart there are several cases in a single day where the OPRB test might be satisfied, giving more chances of not falling foul of entry filters.

Also note that the last OPRB is part of a W pattern, which is an additional hint of an upward swing.
A confirmed break of the green H4 mid-Bollinger band by the candle which opens and closes of above this line is a clincher, although the close proximity of the a weekly pivot can still be something to consider, and a reason to be cautious.
Author:  snailbeard [ Tue Apr 22, 2014 2:20 pm ]
Post subject:  Time for a snooze?

In this slice of an M15 chart, the OPRB occurs in less than fifteen minutes which means most of ZzBb is fast asleep and then wakes up to find price has shot outside the entry parameters:
All times are UTC Page 15 of 28