stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

LibOrderReliable4
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=525
Page 1 of 3
Author:  mbkennel [ Sun Apr 29, 2012 10:04 pm ]
Post subject:  LibOrderReliable4

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.
Author:  SteveHopwood [ Sun Apr 29, 2012 10:10 pm ]
Post subject:  Re: LibOrderReliable4

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
Author:  garyfritz [ Mon Apr 30, 2012 1:57 am ]
Post subject:  Re: LibOrderReliable4

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!
Author:  slipshod [ Mon Apr 30, 2012 2:49 am ]
Post subject:  Re: LibOrderReliable4

+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:
Author:  Dozer [ Mon Apr 30, 2012 3:08 am ]
Post subject:  Re: LibOrderReliable4

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
Author:  mbkennel [ Tue May 08, 2012 5:30 pm ]
Post subject:  Re: LibOrderReliable4

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.
Author:  Raj4x [ Sat Nov 03, 2012 10:28 am ]
Post subject:  Re: LibOrderReliable4

Awesome, extremely helpful, thank you.
Author:  slipshod [ Sun Apr 07, 2013 1:42 am ]
Post subject:  Re: LibOrderReliable4

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
Author:  garyfritz [ Sun Apr 07, 2013 1:48 am ]
Post subject:  Re: LibOrderReliable4

Unfortunately Matt hasn't been around since December. You might want to try emailing him through his profile page.
Author:  slipshod [ Sun Apr 07, 2013 1:57 am ]
Post subject:  Re: LibOrderReliable4

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.
All times are UTC Page 1 of 3