Holy Graily Bob 'n Grid

EA's inspired by nanningbob's work here, especially those based on his 240 Moving Average trend detection filter.
Post Reply
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Holy Graily Bob 'n Grid

Post by SteveHopwood »

SERIOUS WARNING
  • Most Forex traders lose all their money.
  • Using the robot posted here in trading Forex does not guarantee success.
  • Trading this robot could lead to serious financial loss.
  • Trading this robot without understanding its underlying trading strategies guarantees traders will lose their money.
  • This is not a set-and-forget ea; there is no such thing and anyone who tries to claim there is, is either stupid or lying. This ea requires frequent manual intervention.
  • At best, a trading robot is only 90% as good as the manual strategy it trades. At best. At worst, it can be much less effective. If the strategy is rubbish, so is the robot.
  • To trade this robot, you have to understand:
    • How to use EA's.
    • Bob's HGI indicator.
MAKE SURE YOU READ THIS POST http://www.stevehopwoodforex.com/phpBB3 ... 41#p111241 There was a Forex bloodbath on Jan 15th 2015 that you need to know about.

Intro

Holy Graily Bob 'n Grid is an automation of combining grid trading with elements of Bob's Holy Grail Indicator. Download Bob's zipfile from http://www.stevehopwoodforex.com/phpBB3 ... 45#p105045. You need a version of HGI in your Indicators Folder - the latest version is attached to Bob's post 1. Remember to change HGBnG's HGI_Name input to the name of the version you are using, or he will be excessively rude to you.

Newbie traders, you are the luckiest noobs in the history of the train wreck that is retail Forex trading. HGI is the culmination of about 6 years work by nanningbob. You can trade manually by sitting at your console reading a book and simply reacting to the HGI signals. This is the most exciting development in my 8 years experience of the train wreck. Just make sure you absorb "HGI and so-called 'repainting'" from further down this post.

I am trading this EA on my live trading account.

Are you a confused newbie? Don't clutter this thread with requests for basic information - I will delete them. Ask instead at http://www.stevehopwoodforex.com/phpBB3 ... 91#p105691 where friendly souls will help you out.

Origin of this EA

We have cyberevil to thank for this. He wrote to me a couple of weeks ago describing how he was trading using HGI. He had noticed that the markets often travelled a fair distance in the 'wrong' direction after a blue wavy line and big trend arrow signal, and wanted to take advantage of this.

Trading with HGB'nG

I have explained everything in the attached "HGB'nG User Guide" pdf.

A word of warning folks. I loathe writing user guides, and this one took me most of the day. Ask a question here that proves you have not read it and I will move you instantly to the On Moderation group. Members of that group can do nothing except read posts and download attachments. I show dimwits no mercy.

Scripts for manual trade closure and deletion

You will find yourself often closing entire positions manually. The attached zip file contains 4 scripts that go in your Scripts folder:
  • Nuclear option: first closes all market trades and then deletes all pending trades on all pairs, that share the same MagicNumber.
  • Close all trades this pair only: does the same as the Nuclear version, but only on the chart it is dragged onto.
  • The same two scripts as above, but with "FIFO" added to the title. These are for our friends in the US who have to put up with those ludicrous FIFO rules, and who lack the sense to find a broker that has got around them.
I suggest you extract only the scripts that apply to you.

HGBnG Order Sending Script
This is for those of us monitoring their trades whilst away from the computer that does the trading. You can send immediate market trades and all types of stop order. Make sure your inputs are the same as those HGBnG is using. There are no TP or SL inputs - let HGBnG do that for you.


Experimental version
The experimental version has three trading systems:
  • Hedged_Stop_Orders_Only: this is the original Stop_Orders_Only system that CE asked me to code what feels like a lifetime ago: a grid of buy stops above and sell stops below the market price.
  • Non_Hedged_Stop_Orders_Only: this is a new system.
  • Stop_And_Limit_Orders.

Position Monitoring Indi
This is for those of you monitoring your trades from a different machine to the one that is doing the trading. It shows the open position in the same way that HGBnG does.

Have fun Gals and Ungals.


:xm:

Manual intervention
To those of you with the occasional firing brain cell who are not too stupid and lazy to take any notice of anything I write: congratulations on reading this bit. You are in a minority. Read this post:
http://www.stevehopwoodforex.com/phpBB3 ... 77#p119077 You will not be sorry that you did so.


HGI and so-called 'repainting'
Members new to all this have difficulty grasping the implications of this deceptively simple fact: The Holy Grail Indicator works in the here and now:
  • what happened on the previous candle is irrelevant.
  • what happened 5 minutes ago is irrelevant.
  • what happened on the previous tick is irrelevant.
The only thing that matters is what HGI is showing now. There is a problem with this and here it is: the indicator generates a signal. The conditions that generated the trade can change but the signal does not leave the chart until you refresh it by changing time frames or restarting the platform. Thus it looks as though the indi is 'repainting'.

It is not. When loaded, it cannot print a signal for trading conditions that do not exist. The fact that they existed 5 minutes ago is irrelevant; the indi works in the here and now and cannot know that they existed 5 minutes ago? 'Historic' signals are on the chart because the conditions that created them were still in place at the candle close; there is no way of telling how early in the development of that candle those conditions first came into being.

Got it? Tough if not because I do not care. What I do care about is being dragged here to read yet another whinge about 'repainting' by a dimwit too thick to understand the basic concept of 'here and now'. I shall delete posts about it - along with the writer if I am in a bad mood. Sorry to sound harsh, but I am doing some 'heading off at the pass' here.


Matters of general interest
Go here to download and run the script that will fill your platform's missing chart history: http://www.stevehopwoodforex.com/phpBB3 ... f=15&t=254
Read this post:
http://www.stevehopwoodforex.com/phpBB3 ... p?f=6&t=78 Newbie traders, read this for inspiration and warning. Those of you who have suffered losses, read it for inspiration.

Masterly summary of hedging: http://www.forexfactory.com/showthread. ... ost4977179

EA coding
I receive may requests to code EA's. Traders, if I code your EA for free, then I will share it here. If you want me to code your EA without sharing, then my fee is $100 payable into my paypal account. I explain why at http://www.stevehopwoodforex.com/phpBB3 ... ?f=15&t=79, at the bottom of the post.

Useful utilities/EA's/scripts -

-
You do not have the required permissions to view the files attached to this post.
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Making teensy weensy code changes

Post by SteveHopwood »

Even someone who has never coded anything ever before can make the teensy weensy code changes that are cropping up from time to time.

Remember, you cannot do any harm. If the worst comes to the worst, you simply download the fixed version from post 1.

Here is what to do:
  • Go to your crapform's Navigator widow and look at Expert Advisors.
  • If there is a + in the box, left click to display the EA's you have on your platform.
  • Right click on "Holy Graily Bob 'n Grid" (or whatever thingy it is you want to edit) and left click "Modify".
  • Wait a few seconds for the code editor to load.
  • Navigate to where I have told you to go:
    • If it is a line number, then Gtrl + G opens the 'Go to' box. Enter the line number into the box and click OK.
    • If it is a function I have named, then Alt + M will open the functions list. Scroll down the list with your mouse and click on the name of the function. The editor will take you there.
  • Make the edit.
  • Press the F7 key to compile the code. A window will appear at the bottom of your screen. You will know if you have made a mistake because you will see a red error message. Double clicking will take you straight to the error. Repeatedly press Ctrl + Z to return to where you started if you become confused.
Compiling your code instantly transfers the new code to all instances of your ea's running on all your charts, so you do not have reload them.

Variables shown to you via the Inputs window have 'extern' (for 'external') in front of them e.g.
extern int TakeProfitPips;

You can make changes to your own lot sizes, tp's, sl's etc so that they are your defaults when you load the bot onto a chart. Just note that changes to extern variables are not passed to all the other instances of the bot on other charts. I put my externs close to the top of the file.

Play around folks. Have fun. You cannot do any harm.

:xm:

________________________________________________________________________________________
Note for fledgling coders:

HGBnG is a shell to which you can easily add your own indicators once you know how. I posted a tutorial describing how to add your own indis to my shells at http://www.stevehopwoodforex.com/phpBB3 ... 32#p131732

I suspect that learning how to add your own stuff whilst still at an early stage in your coding development is not easy. I do not suppose you will find the tutorial a doddle to follow. I promise that once you have figured out how simple it is once you understand the process, then you will fly.

I have uploaded a version of HGBnG to which I have added a Stochastic overbought/sold filter. It will only allow buy trades when stoch is oversold, and sells when overbought. Follow the bookmarks (F2 key) through the code to see what I have done. It took me about 30 minutes to add the filter and would have taken less had I not wanted to leave a commentary describing what I was doing.

In case the bookmarks go missing or you want to follow the code entry in the order in which I did it, here are the relevant line numbers:
  • 113 defines an enumeration for the stoch mode. There must be a crapql4
    constant, but I cannot find it.
  • 425 Declares the user inputs and a variable to hold stoch's value. Notice how I precede each input and the variable with "Stoch". I do this because more than one indi can have the same input, so my method reminds me which indi is being consulted. Also, being consistent means the auto-finish editor feature will always show me the correct list of variables - saves hours of going back to see what I have called an input.
  • 2235 is the function that reads the stochastic indi - double GetStochastic(........). Coding functions in the way I do has two huge advantages:
    • It can be called with multiple sets of values. double GetMa(........) is a great example of this. Both sets of moving average filters call the same function with different parameters.
    • It is easily imported into a multi-pair ea.
  • 2276 calls GetStochastic(........). The code automatically takes care of the your choice of EveryTickMode.
  • 711 sets up the chart display so you can check your ea is working with the correct stoch value.
  • 1775 adds the filter to a potential buy trade.
  • 1812 adds to filter to a potential sell trade.
For an example of how to code a function that reads a custom indicator (aka Crap Custom Abortions because that is what they usually are) see double GetSemaphor(......) at line 2220.

For an example of how to code a function to read HGI, see double GetHGI(......) at line 2190. In a piece of inspired genius, Tommaso coded HGI in such a way that there is no need to send an extensive list of indi inputs with the call.

:xm:
You do not have the required permissions to view the files attached to this post.
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

The hedging version

Post by SteveHopwood »

This page describes HGBnG when StopOrders is enabled.

Here, HGBnG tries to cash in on the tendency the market has to scream a lot of pips in the opposite direction the moment HGI generates a signal. There are those deluded people who think that the markets are not a living entity. We here know both that it is a living entity and that it has a vicious sense of humour. :lol:

The conditions that generated the signal disappear but we catch the opposite direction trades when the moves happens quickly.

The pendings are deleted if the move happens more slowly. An opposite direction trade sometimes fills before the market resumes in the direction indicated by HGI and we end up with a hedged position - the reason US citizens cannot currently use this method of trading.

Using a buy signal as an example, here is what the bot does:
  • wait for a large green trend arrow or blue buy wavy line.
  • send a grid of buy stops x pips above the market, and a grid of sell stops x pips below the market.
  • when the market behaves and hurtles off in the right direction, great. Eventually the buy stops fill and hit tp. Once they have all hit tp, the outstanding sell stops are deleted.
  • if instead the market hurtles off in the opposite direction, eventually all the sell stops will fill and hit tp, then the outstanding buy stops are deleted.
  • if the market travels far enough in the wrong direction to fill the first sell stop then resumes in favour of the buy signal, eventually a buy stop fills.
    • The position becomes a hedged position; any stop loss and take profit values are removed from the trades.
    • There are hedge position profit targets, and the EA will close the position once they are hit.
    • Default size for the grid is 3 buys and 3 sells, so in the case of wild chop the worst that can happen is we end up with a totally locked position of 6 trades. It is then up to us to decide what to do manually.
There are two profit targets for hedged positions, and we can use both:
  • HedgeProfitPips: a closure target expressed in pips - default 30. A zero value turns this feature off.
  • HedgeProfitCash: a closure target expressed in cash - default zero. A zero value turns this feature off.
Using the default grid size and distance between the trades, it would take manic movement of 180 pips from top to bottom of the swing. This will happen - and probably the instant we all start to run this robot. :arrrg: What to do then is an area we shall have to explore.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Non-hedging version

Post by SteveHopwood »

This page describes HGBnG when StopAndLimitOrders is enabled.

Taking a buy signal as an example:
  • Wait for a big green arrow or a buy wavy blue line.
  • Using the default settings when a signal appears:
    • send 3 buy stop trades starting 30 pips above the market price.
    • send 3 buy limit trades starting 30 pips below the market price.
  • Monitor the position and:
    • delete the pendings if the conditions that made HGI generate a signal disappear and none of the pendings have filled.
    • close market orders and delete pending trades if HGI generates an opposite direction trade.
The advantages of this are obvious if the market retraces far enough to fill some limit orders. At worst, the default of 3 trades will hit their stop loss and the bot should then delete the outstanding stop orders.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
cyberevil
Trader
Posts: 95
Joined: Mon Oct 26, 2015 5:55 pm
Location: Vancouver, BC

Holy Graily Bob 'n Grid

Post by cyberevil »

Wow, already so much activity on this. Thanks Steve for creating the EA and very descriptive posts to describe it's functionality. :hi: I also want to take this time to thank Bob for the HGI; Tommaso and Elixe for their had work to automate his vision. And anyone else involved that I am not aware of. Also, Just to show you guys the power of this little monster. I'm attaching a screen shot of couple of trades it took for me in a short period of time. I have tested this idea manually for sometime now where I was able to create large profit on demo. I would not recommend going live with this to anyone at this moment. Unless you're super rich, then try it with penny account. 8-)

Remember, we're in December now and the financial markets are calm one day and crazy the next day due to how the global money moves around the planet. With all kinds of sales like black Friday, Cyber Monday, boxing day and lots of other news like cash rates, employment changes, big business making big transactions and overall everyone being in the lazy holiday sprits. :party:

This might be the perfect time to test this EA :roll:

I encourage everyone to read Steve's posts from page 1 to get a good understanding of the idea/concepts. For most part traders familiar with HGI should have no problems with this. Last but not least please don't be shy to post your finding here but keep it relevant to this topic. With collective minds perhaps we can turn this into something that'll generate profits for our little community here.

Thanks!
Capture.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Holy Graily Bob 'n Grid

Post by SteveHopwood »

I just love it when a pair falls off a cliff like UJ in the last 8 hours. It looks for all the world as though is is the HGI blue wavey that kicked it. :lol:

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
bazze

Holy Graily Bob 'n Grid

Post by bazze »

cyberevil » Wed Dec 09, 2015 6:49 pm wrote:Wow, already so much activity on this. Thanks Steve for creating the EA and very descriptive posts to describe it's functionality. :hi: I also want to take this time to thank Bob for the HGI; Tommaso and Elixe for their had work to automate his vision. And anyone else involved that I am not aware of. Also, Just to show you guys the power of this little monster. I'm attaching a screen shot of couple of trades it took for me in a short period of time. I have tested this idea manually for sometime now where I was able to create large profit on demo. I would not recommend going live with this to anyone at this moment. Unless you're super rich, then try it with penny account. 8-)

Remember, we're in December now and the financial markets are calm one day and crazy the next day due to how the global money moves around the planet. With all kinds of sales like black Friday, Cyber Monday, boxing day and lots of other news like cash rates, employment changes, big business making big transactions and overall everyone being in the lazy holiday sprits. :party:

This might be the perfect time to test this EA :roll:

I encourage everyone to read Steve's posts from page 1 to get a good understanding of the idea/concepts. For most part traders familiar with HGI should have no problems with this. Last but not least please don't be shy to post your finding here but keep it relevant to this topic. With collective minds perhaps we can turn this into something that'll generate profits for our little community here.

Thanks!
First of all a big thank you to Steve for creating this :good: Second, is this ootb setting you are using for these good results?
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Holy Graily Bob 'n Grid

Post by SteveHopwood »

bazze » Wed Dec 09, 2015 9:22 pm wrote: First of all a big thank you to Steve for creating this :good: Second, is this ootb setting you are using for these good results?
Yep. The huge advantage of being the coder is getting to hard code my own setfile. Just bear in mind that the lotsize equates to 0.01 per $1000 on my GP demo.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Holy Graily Bob 'n Grid

Post by SteveHopwood »

I have added another 203 pips today c. 1.5% on the start balance. I am left with a hedged AU and a GU that looks as though it might be stalling but HGI gives a RAD, so I am leaving the trade open. Perhaps it will pick up in the morning. We shall see.

Before we all get too excited, remember that recent days have seen some wild movements and HGI is ideally placed to take advantage of them. HGBnG might not be so successful in quieter times.

Having said that, the thing that persuaded me to code the bot in the first place was cyberevil saying that he had been trading like this manually for some time. There are few statements that grab my attention better than that. :yahoo:

We shall see. The hedging element should be enough to ensure that only a total cretin can blow their account, so the bot is reasonably safe. Sure, manually closing a fully hedged position is going to cost all the swap, commission and spread, but that is nothing like having 3 unhedged trades all hitting their stop loss.

In the meantime, let the fun continue.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
cyberevil
Trader
Posts: 95
Joined: Mon Oct 26, 2015 5:55 pm
Location: Vancouver, BC

Holy Graily Bob 'n Grid

Post by cyberevil »

Nobody would have seen UJ the way it fell overnight. In the current cycle, US interest rates are poised to rise, and this will likely continue to support the USD/JPY. We thus see Japan's C/A surplus less as a possible factor for turning the USD/JPY's upcycle downward in 2016, and rather as a potential factor for capping upside. This is according to the fundies out there.. :o

This is not out of the box settings for me, I tinkered with this EA for a week or so through its development to get it to my liking and the way my mind sees the market. This is the beauty of this EA. Once you have a good understanding of the variables. You can really make it match your trading style. ;)

I'll explain a bit more, I'm getting questions in regards to how Steve trades H4 and my screenshot of M15. My personal favorite TF is M15 because I like to have a good sense on the direction/trend of the market from higher TFs and mostly because I lack patience and like to get in and out quickly. I have most experience with price action on M15 and I have seen the relationship between HGI and price action on this time the most. This is just how my brain is wired. That is not to say you can't use H4. As a matter of fact HGI was made to be used H4 or higher TFs. You can look at D1 to confirmation if you like. I do use H4 myself but I'm very selective on when to use/start the EA on H4. With H4, you have to be very patient and let the EA do it's thing. I use it for long term trends and usually pick nested trades within using M15 also. :geek:
Post Reply

Return to “Thingy Bob EA's”