Nanningbob V5: Steve Hopwood's auto-trading robot
In the 'posting restrictions' section lower down, I have posted a link to a new thread where newbies can ask for help. I ask more experienced people to bookmark the thread and add a email notification so that you can help out the newbs when they get stuck.
Bulge BB Buys and Sells
I just realised a possible method for the bulge buys and sells. Bollinger Bands have a couple of related metrics called %B, and Bandwidth indicator (sample indicators attached). These show where price is in relation to the bands, and how wide the bands are in relation to past band activity. Bandwith indicator is used primarily to assist with the famous bollinger bands squeeze trade - breakout after a period of low volatility, which is generally what happens to create NB's BB bulges. I'm sure that Bandwidth indicator can be used once it exceeds a threshold (with the threshold determined perhaps by stochasticization over a period of previous data, much like what Squalou did to MACD).
Bolinger Bands %b can help quantify those elusive conditions like "wait for some price separation from the bollinger bands before turning on EA #2", or even more straightforward things like - inside or outside upper or lower bands by a set percentage, et al.
Bollinger Bands %b.mq4
I have adopted %b to spot the separation.
Bandwidth Indicator has allowed me to code #3 functions. The relevant input is MinimumBulgeWidth; the default is a guess based on seeing that values over 5 usually represent a bulge on the H4.
This function is a bit of a blunt instrument and might not work properly. All it does is say, "Hey, the bandwidth is > MinimumBulgeWidth, so there is a bulge, so I am going into bulge trading mode."
We shall see.
Thanks Steve for all your help. It simply is impossible for me to keep up with all the developments and testing. I appreciate very much your help and the help of all the others. Be neat if all this works out.
Got the demo account set up with the ea ready to do its thing.
I noticed I was getting a bunch of Zero Divide errors from the Bandwidth Indicator and that it was sometimes unloading. I looked at the coding and noticed the following:-
It calls the:-
Ibands does not support a 0 buffer, only a 1 and 2 for Upper and Lower.
Anyhow the MB was supposed to refer to the center line of the BBands. I made the change:--
Works like a charm now.
Strangely enuff even tho the indicator was coded with the invalid buffer, it gave the correct values when it worked.
See attached, I have used a v1 for differentiation, but for ease, it may be best to save over the original if you are having the same problem
The cause is at the beginning of the data (i=limit), and the solution is to check the mb value:
if (mb!=0) BWI.Buffer[i]=((ub-lb)/mb)*100;
I thought so too, (since it's more like a default), i checked the MQL manual it specifically states 1 and 2.
But the really does work as you indicated... interesting.
It looks as though merely using Bandwidth as a bulge-spotter is not going to work. I just knew it could not be that simple. Hey ho.
I think Swingman is right - the check needs to be if (mb==0) BWI = 0 to avoid divide by zero error.
I spotted a couple of copy/paste bloops in the bulge-spotting routine, so these are fixed in post 1.
I persuaded Nb to take a bulge trade by turning MinimumBulgeWidth down to 2, so it is now in the audnzd trade that I took live with the #1 ea much earlier today.
I suppose we just have to play with this and see what happens.
Can anyone come up with an algorithm for #4?
Hi Steve, can you please change for me in the thread title "autrading" in "autotrading"...? In Google I can not find what this mean...
But what is "autrading", this is the question...?
I have had another try.
Sorry mate, still "autrading here". Anyway, what it does is most important
I have added #4 functionality to NB, assuming this to be a range-trading method.
Details in post 1 and the user guide.
© Forex Factory