My shell EA code

Post Reply
MrPip
Posts: 4
Joined: Sat Oct 27, 2012 8:16 am

Re: My shell EA code

Post by MrPip »

magft wrote:
SteveHopwood wrote:youcrazykids, no way am I going to ridicule this. Thanks. I shall look at it and perhaps adopt it.

Mike, sorry but I only saw your latest when looking at yck's post; I missed it when you posted it. Does the code work for our cousins in upside-down land?

Cheers guys

:D
George has posted a much cleaner version that seems to work on my Fratelli EA thread so i'm posting the script here for your thoughts.
I just found this forum and have a version of checking trade times that allows for times like 23:00 to 02:00 for Asian session. I use hour and minute inputs so you can even test values in strategy tester.

I will post when I find that no one else has already posted the same code. I have posted this method as part of EAs on several other forums so you never know.

Robert Hill aka MrPip
Professional Empty4 Programmer
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.

Re: My shell EA code

Post by SteveHopwood »

Hi Robert. Wonderful to see you here.

Guys, Roberts post reminded me to put the latest versions of the 10.2A and bare bones shells in post 1. I have gradually corrected mistakes in them as I have used them.

Most usefully, Paul tidied up the time-checking code so that it works properly in a single-pair trader. It is brilliant.

Hehe. You can always tell when it is someone else's code (quite apart from the acknowledgement) cos it is brilliant. :lol:

:D
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.

Red alert

Post by SteveHopwood »

Ehup guys

Gary just sent me this pm:
garyfritz wrote:Steve, the recent question about CloseEnough() caused me to look at the code, and there is a glaring problem. I don't know how this slipped through before, but it needs to be fixed.

Code: Select all

if (num1 == 0 && num2 == 0) return(true); //0==0
if (MathAbs(num1 - num2) / (num1 + num2) < 0.00000001) return(true);
The test should be
if (MathAbs(num1 - num2) / (MathAbs(num1) + MathAbs(num2)) < 0.00000001) ...

With the current code, if num1 = -num2, you'll get a divide-by-zero error!

Sorry for the goof!
Gary
These changes
garyfritz wrote:Steve, the recent question about CloseEnough() caused me to look at the code, and there is a glaring problem. I don't know how this slipped through before, but it needs to be fixed.

Code: Select all

if (num1 == 0 && num2 == 0) return(true); //0==0
if (MathAbs(num1 - num2) / (num1 + num2) < 0.00000001) return(true);
The test should be
if (MathAbs(num1 - num2) / (MathAbs(num1) + MathAbs(num2)) < 0.00000001) ...

With the current code, if num1 = -num2, you'll get a divide-by-zero error!

Sorry for the goof!
Gary
Future releases will include these changes. For now, be aware that your shell code has the goof; it could well explain otherwise un-findable zero divide errors.

Thanks for the heads-up Gary.

:D
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.
intcust
Trader
Posts: 285
Joined: Wed Oct 03, 2012 9:12 pm

Re: My shell EA code

Post by intcust »

I am new to the code stuf. Want to learn to fish. How do I code ea to enter a second trade different pair x pips from when the intial trade was made. Example sell eu then at 100 pips out buy gbp usd.

Thanks,

Tom
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: My shell EA code

Post by fxdaytrader »

I tried to change the ea shell (bare bones), added some functions (like psar trailing) and made it modular so building new eas should be less complicated for ones who are not familiar with mql.
See sourcecode for details ;)

Bare Bones Slope EA.shell ea code.ex4

Bare Bones Slope EA.shell ea code.mq4
main module, belongs to /experts/ folder. It includes all the mainfunctions (like trademanagement).
"TradeLong" and "TradeShort" are set to false, so if you want the ea to open trades, set it to true!

If the mainmodule is bugfree, you do not have to change anything there.
Just edit the include-file, specifie its name in line 26 in the main module (current: #include <include.ea-shell.bare-bones_slope_EA.mqh>), save it under a new name and that is it.

include.ea-shell.bare-bones_slope_EA.mqh
belongs to experts/include/ folder. Includes all the functions of the ea you want to build. Please see instructions in the sourcecode.

include.ea-blank.mqh
blank include file, just the necessary functions, so its easy to understand how it works.

I added some standard-indicator functions, may be they are useful for somebody.
But I do not know if these are correct:
double getVROC(string symbol,int timeframe,int period,int shift)
double getPVT(string symbol,int timeframe,int applied_price,int shift)
double getASI(string symbol,int timeframe,double T,int shift)

~Mt4iSendMail_setup.zip
setup for the Mt4i SendMail library, may be also downloaded at http://www.mt4i.com/appstore/app.aspx?id=17

~twt_twitter_setup.zip
the twitter client, may be also downloaded at http://code.google.com/p/twt/
The twt.exe and the config (will be created after successful initialization) belong to the experts/fildes/-folder.

CmdExe.mqh
belongs to experts/include/-folder. Is needed if you want to use the twitter function.


Please report bugs ;)

edit: If you prefer german, have a look to the corresponding thread at forexfabrik.de, here (do not refer to it as "Krautforum" :mrgreen: )
Bare Bones Slope EA.shell ea code.mq4
include.ea-shell.bare-bones_slope_EA.mqh
~Mt4iSendMail_setup.zip
~twt_twitter_setup.zip
CmdExe.mqh
include.ea-blank.mqh
edit:
new attachments, with less bugs and more functions. Just load the .ex4 (or compile for yourself) and play around. Do not forget to set "TradeLong" and "TradeShort" each to "true". And, only use on demo ... :)
EA template.shell ea code.ex4
EA template.shell ea code.mq4
include.ea-template.mqh
You do not have the required permissions to view the files attached to this post.
Last edited by fxdaytrader on Mon Dec 17, 2012 12:28 pm, edited 6 times in total.
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

Re: My shell EA code

Post by dietcoke »

fxdaytrader wrote:I tried to change the ea shell (bare bones), added some functions (like psar trailing) and made it modular so building new eas should be less complicated for ones who are not familiar with mql.
See sourcecode for details ;)

Bare Bones Slope EA.shell ea code.ex4

Bare Bones Slope EA.shell ea code.mq4
main module, belongs to /experts/ folder. It includes all the mainfunctions (like trademanagement).
"TradeLong" and "TradeShort" are set to false, so if you want the ea to open trades, set it to true!

If the mainmodule is bugfree, you do not have to change anything there.
Just edit the include-file, specifie its name in line 26 in the main module (current: #include <include.ea-shell.bare-bones_slope_EA.mqh>), save it under a new name and that is it.

include.ea-shell.bare-bones_slope_EA.mqh
belongs to experts/include/ folder. Includes all the functions of the ea you want to build. Please see instructions in the sourcecode.

include.ea-blank.mqh
blank include file, just the necessary functions, so its easy to understand how it works.

I added some standard-indicator functions, may be they are useful for somebody.
But I do not know if these are correct:
double getVROC(string symbol,int timeframe,int period,int shift)
double getPVT(string symbol,int timeframe,int applied_price,int shift)
double getASI(string symbol,int timeframe,double T,int shift)

~Mt4iSendMail_setup.zip
setup for the Mt4i SendMail library, may be also downloaded at http://www.mt4i.com/appstore/app.aspx?id=17

~twt_twitter_setup.zip
the twitter client, may be also downloaded at http://code.google.com/p/twt/
The twt.exe and the config (will be created after successful initialization) belong to the experts/fildes/-folder.

CmdExe.mqh
belongs to experts/include/-folder. Is needed if you want to use the twitter function.


Please report bugs ;)


Bare Bones Slope EA.shell ea code.mq4
include.ea-shell.bare-bones_slope_EA.mqh
Bare Bones Slope EA.shell ea code.ex4
~Mt4iSendMail_setup.zip
~twt_twitter_setup.zip
CmdExe.mqh
include.ea-blank.mqh

Nice one. definitely interested in mt4i email module
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.

Re: My shell EA code

Post by SteveHopwood »

fxdaytrader wrote:I tried to change the ea shell (bare bones), added some functions (like psar trailing) and made it modular so building new eas should be less complicated for ones who are not familiar with mql.
See sourcecode for details ;)
Nice one fxdaytrader. I have linked this in post 1.

:D
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
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: My shell EA code

Post by fxdaytrader »

Attached one modul for the use of icustom-indicators.
specify the buffers and values to look for (see sourcecode) ...

include.icustomIndicatorSignals_EA.mqh
The main module (here named bare bones) can be found here
You do not have the required permissions to view the files attached to this post.
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.

Re: My shell EA code

Post by SteveHopwood »

Latest versions of my shells are in post 1. There is a new one that is Bare Bones plus Recovery. I have also added the code necessary to add Slope to an existing EA.

As I use the shells to code ea's, the bloops in the shell come to light. When I fix them in the new EA, I go back to the shells and add the fix to them. There have been a number of these since my previous update, so the new code is less prone to bugs and LUC than previous versions.

:D
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.
investguy
Posts: 7
Joined: Wed Apr 18, 2012 5:17 am

Re: My shell EA code

Post by investguy »

fxdaytrader wrote:Attached one modul for the use of icustom-indicators.
specify the buffers and values to look for (see sourcecode) ...

include.icustomIndicatorSignals_EA.mqh
The main module (here named bare bones) can be found here

I just made use of your code today, great piece of work you did here with Steve and many others.
Sweet! Let me know if you make any updates.
Post Reply

Return to “Coders Hangout”