LibOrderReliable4

mbkennel
Trader
Posts: 29
Joined: Tue Dec 20, 2011 5:40 am

LibOrderReliable4

Post by mbkennel »

This is the intended home of LibOrderReliable4.

It is a library which wraps the standard MQ4 order handling functions, and adds some related ones.

It has two files: LibOrderReliable4.mqh, which goes in the experts\include directory,
and LibOrderReliable4.mq4, which goes in the experts\libraries directory.
You do not have the required permissions to view the files attached to this post.
"It is a capital mistake to theorize before one has data." Sir Arthur Conan Doyle.
"If your experiment needs statistics, you ought to have done a better experiment" Lord Rutherford.
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: LibOrderReliable4

Post by SteveHopwood »

Matt, totally fabulous that you should do this.

Many thanks. I have made this thread a sticky so it does not get lost.

Guys, Matt's is the 'industrial strength' code that I occasionally cite when some poor sap posts that an instance of an EA has sent multiple trades. We are unbelievably lucky to have the code.

Cheers Matt

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

Re: LibOrderReliable4

Post by garyfritz »

Awesome, Matt, thanks. Yow, you've been wrangling with Empty4 for 6 years!? I need to bug you more often. :D

Lovely to see such carefully and extensively-documented code. Something over 1/3 of the lines in the library file are comments, and they are clear, useful comments. This is a fabulous example to all coders!
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: LibOrderReliable4

Post by slipshod »

+1 to everything Steve & Gary said. This is some of the best code I've ever seen released for Empty4, and I'll be using it with gratitude :ugeek:
Dozer
Trader
Posts: 25
Joined: Wed Nov 16, 2011 4:32 pm

Re: LibOrderReliable4

Post by Dozer »

Matt,

Several times I've meant to send you a note thanking you for this code library. I wouldn't think of using a Empty4 EA without it. It's really sad that Empty4 needs so much additional code to help ensure trades are handled in a more robust fashion, but we are fortunate that someone took the time to write, support and share such excellent code. Seriously man.... thank you :D

Dozer
mbkennel
Trader
Posts: 29
Joined: Tue Dec 20, 2011 5:40 am

Re: LibOrderReliable4

Post by mbkennel »

You're welcome. Now onto finding, and sharing, good techniques.

Note that the GPL license in LibOR is intentional, so (unless you negotiate something with me) if you distribute any code linked in with this code, including commercially, the full source must be provided free of charge.
"It is a capital mistake to theorize before one has data." Sir Arthur Conan Doyle.
"If your experiment needs statistics, you ought to have done a better experiment" Lord Rutherford.
Raj4x

Re: LibOrderReliable4

Post by Raj4x »

Awesome, extremely helpful, thank you.
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: LibOrderReliable4

Post by slipshod »

Matt, I'm surprised so many EAs on this site don't use this library. I'm of the opinion that they all should.

That said, if you ever look at releasing an update there's a few things I'd like to see...

1. Specifying the number of retries, which right now is hard-coded to 10. Could be a function called in the init() area, eg. O_R_SetRetries(3)

2. Specifying the verbosity of the library in its Print statements. Right now it spits out quite a lot, which can make it hard to see prints produced by the EA. Options could be something like 0 (absolutely silent), 1 (minimal info sent to Print, usually a single line confirming trades placed or failed) and 2 (default, prints the same as it does now).

3. Using NormalizeDouble to ensure valid price values doesn't always work - you still see Invalid Price errors. A better method would be to replace NormalizeDouble calls with NormalizePrice(symbol, price), with the new function as follows:-

Code: Select all

double NormalizePrice(string symbol, double price)
{
   double ts = MarketInfo(symbol, MODE_TICKSIZE);
   return(MathRound(price/ts) * ts);
}
I've implemented all the above in my own local copy, but it'd be much better if you'd consider the ideas for a new official version of the library.

Edit: The rational behind the need to use Ticksize rather than Point is explained here: http://forum.mql4.com/45425#564188. It also requires a check of the lot size (something else this library doesn't do but really should).

cheers,
Andrew
Last edited by slipshod on Sun Apr 07, 2013 12:16 pm, edited 3 times in total.
garyfritz

Re: LibOrderReliable4

Post by garyfritz »

Unfortunately Matt hasn't been around since December. You might want to try emailing him through his profile page.
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: LibOrderReliable4

Post by slipshod »

Oh ok, hadn't noticed! Its possible he might have subscribed to this thread in which case he'll get an email, but if he hasn't responded in a few days I'll chase him up. I guess I could always post my own version here, but I'd much rather not create a fork if it can be avoided.
Post Reply

Return to “Coders Hangout”