HGBnD shell

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

HGBnD shell

Post by SteveHopwood »

Attached are:
  • a code shell to enable you to create your own flavours of HGBnD quickly and easily. This is a small file.
  • the HGBnD core library.mqh library that holds most of the working functions. This goes in your Include folder. You need either to point people towards it if you distribute your own EA, or include it when you start your thread.
  • a user guide for you to adapt to your own EA should you plan to share it with SHF members.
  • Rene's controller.
Rene prompted Thomas and I to create the library so that future alterations to the code do not have to be distributed through umpteen members of the HGBnD family. Included In it are these 4 functions:
  • void UsualOnInit() contains all the stuff from OnInit().
  • void UsualOnDeInit() contains all the stuff from OnDeInit().
  • bool UsualOnTick() contains all the stuff from OnTick().
  • void ReadUsualIndicatorValues() which is the old ReadIndicatorValues().
ReadIndicatorValues() is where you add your own indicator and code your trading decision in the usual places.

There are lists of comments or codes to search for the places in the code that you might need to alter, at the bottom of each file. I have stopped writing the line numbers - I found it easier to find the places by doing the search when using the shell to create new EA's.

Do a search in the shell for "#include <HGBnD core library.mqh>". This is line 238 at the time of writing this but may change over time. The #include command is there to make the compiled version show the extern inputs first. extern inputs in the library will be shown after the command, so you adjust the way your own are shown by adjusting the position of the #include command - although you will probably never need to. Users will not notice any difference between EA's created using the new shell and library and those created using the previous one.

Rene's additions to all this :clap: :clap: :clap: :clap: :clap:
1) It is possible to disable EA's created by this shell in the lead up to a news release - this applies to all of the Dotty family and pretty much everything I have coded for about 3 years. Go to Rene's http://www.stevehopwoodforex.com/phpBB3 ... =97&t=5039 and download the EA. It goes on a single chart on your Empty4 platform and set up the inputs to do whatever it is you want it to do. Rene's EA will talk to all of mine and stop them doing anything in the run up to a news release. You do not have to alter any of the code in the shell for this to happen.

2) Rene's HGBnD - MultiSymbol - Controller.mq4. Rene coded this in response to a request from a member, for an EA that would stop further trading once x numbers of pairs have trades open. This is an added part of our anti over-trading armoury.

Here is Rene's explanation from the PM hse sent me:
The idea is this: The user installs HGBnDnSSnFB (or whichever member of the HGBnD family) on as many pairs they desire (one chart for each pair). I have tested this with 28 pairs, without any problems. Then, they install the HGBnD - MultiSymbol - Controller on another pair (eg. XAUUSD, but it doesn't really matter). There are three parameters to configure:
  • MagicNumber
  • MaxNumberOfOpenSymbols
  • MaxNumberOfOpenCurrencies
I think that their names explain their function.
The default inputs of -1 effectively disable the controller.

sinput
This is a useful replacement for extern when using libraries. I discovered that comments following an extern input resulted in the user being shown the comment in the inputs window, instead of the variable. For example:

Code: Select all

extern double RiskPercent = 0;//Over rides lot
would result in "Over rides lot" being shown to the user. This could be useful in the future but not here as it buggers up attempts to read the user guide for help.

Change the code in my example to:

Code: Select all

sinput double RiskPercent = 0;//Over rides lot
results in the user being shown the variable rather than the comment.

Note that sinput creates a constant and so will not work for, say, the Lot input. The value of this input is checked to confirm that it is allowed by the broker and changed if not to meet the broker's minimum requirements. An mql4 constant cannot be changed in code, so the use of sinput generates an error.

Easiest when writing new code, is to use sinput and change to extern when the compiler throws a hissy fit.

NOTE: sinput appears to have stopped working.

:xm:

Before questioning my code
Before questioning my code, here are a few thingies to consider:
  • I have been around the block a few times. I am quite good at this stuff these days. SHF has not become the force it is because I am Mr Dimwit from Dimwitsville, Dimwitcounty, Dimwitworld.
  • Much of the code has been donated over the years by coders whose skills are so far in advance of mine that they show me up as the amateur coder that I really am.
  • Said code from these experts has worked flawlessly and seamlessly for years. FOR YEARS.
So, you think you have found a 'bug' in code that has worked flawlessly and seamlessly FOR YEARS. Here is what to do: assume you are an idiot incapable of understanding what the code means; stay quiet.

Suppose you are still forum death-wishingly tempted to post about the non-existent bug, here is what to do:
  • bear in mind that I am the forum owner and that my power here is aboslute. I am a forum tyrant and wield that power mercilessly.
  • consider posting about the 'bug' you have just found in code that has worked flawlessly and seamlessly FOR YEARS. From there:
    • contemplate my reaction to spending a couple of hours hunting down a non-existent 'bug' only to discover that it really was you being a cretin (ask around if new here) - it has happened.
    • shudder delicately, change your mind about posting and move on to a different subject.
Feel free to ignore this advice if your SHF membership is of no value to you.


.
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. pianodoodler@hotmail.com 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: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

HGBnD shell

Post by SteveHopwood »

I have used the shell to recreate HGBnDnSS and found a couple of thingies that needed changes. I also found that bool LookForFullHedgeTradeClosure(int ticket) needed amending.

I have uploaded the new version to post 1 and updated the check list.

: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. pianodoodler@hotmail.com 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.
szfxtrader
Trader
Posts: 377
Joined: Sun Feb 10, 2013 9:36 am

HGBnD shell

Post by szfxtrader »

SteveHopwood » Thu Feb 16, 2017 9:22 am wrote:I have used the shell to recreate HGBnDnSS and found a couple of thingies that needed changes. I also found that bool LookForFullHedgeTradeClosure(int ticket) needed amending.

I have uploaded the new version to post 1 and updated the check list.

:xm:
Thank you very much!
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

HGBnD shell

Post by SteveHopwood »

I forgot to mention that I have replaced the existing pip factor code with the function Tommaso coded into his APTM. This should allow these bots to run on just about anything that moves. Brilliant coding Tommaso. Thanks. :clap: :clap: :clap: :clap: :clap:

: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. pianodoodler@hotmail.com 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.
szfxtrader
Trader
Posts: 377
Joined: Sun Feb 10, 2013 9:36 am

HGBnD shell

Post by szfxtrader »

Hi Steve,

I am taking a look at the code, what do you think about the following change?

Code: Select all

int OnInit() {

//Initialize libCSS
from: libCSSinit();
to: if (UseCSS) libCSSinit();
Thank you in advance for your reply.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

HGBnD shell

Post by SteveHopwood »

szfxtrader » Sat Feb 18, 2017 10:19 am wrote:Hi Steve,

I am taking a look at the code, what do you think about the following change?

Code: Select all

int OnInit() {

//Initialize libCSS
from: libCSSinit();
to: if (UseCSS) libCSSinit();
Thank you in advance for your reply.
Yep. Definitely. Thanks. :clap: :clap: :clap:

: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. pianodoodler@hotmail.com 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.
szfxtrader
Trader
Posts: 377
Joined: Sun Feb 10, 2013 9:36 am

HGBnD shell

Post by szfxtrader »

SteveHopwood » Sat Feb 18, 2017 11:09 am wrote: Yep. Definitely. Thanks. :clap: :clap: :clap:

:xm:
Welcome, it is a pleasure to be able to contribute a bit.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

HGBnD shell

Post by SteveHopwood »

Line numbers quickly get mucked up as we add extra code to the shells, so I have edited the list in post 1 by adding the relevant line of code or comment. We can do a search for the code to find the place easily. I have also added this list to the bottom of the code.

: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. pianodoodler@hotmail.com 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: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

HGBnD shell

Post by SteveHopwood »

I have updated the shell with the improved buy-low-sell-high code, updated the shell user guide and the line numbers list. Post 1.

: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. pianodoodler@hotmail.com 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.
szfxtrader
Trader
Posts: 377
Joined: Sun Feb 10, 2013 9:36 am

HGBnD shell

Post by szfxtrader »

SteveHopwood » Tue Feb 21, 2017 10:00 am wrote:I have updated the shell with the improved buy-low-sell-high code, updated the shell user guide and the line numbers list. Post 1.

:xm:
Thank you very much!
Post Reply

Return to “Thingy Bob EA's”