help me test EA

 

Before my EA works well, but 20 days it does not work anymore, do not buy, not sell whether the market is still volatile. someone help me see the EA need to fix faulty nowhere.

Now : 2012-05-18.

 

Why aren't you checking your return values ? if you did you could then report the error back to the logs . . . and then you might know what is going on.

Now: 20 May 2012

 
nguyenhiennhan:

Before my EA works well, but 20 days it does not work anymore, do not buy, not sell whether the market is still volatile. someone help me see the EA need to fix faulty nowhere.

Now : 2012-05-18.

Check my example here of using OrderSelect() https://www.mql5.com/en/forum/139575

Now : why ?

 

Good advice there from RaptorUK. You don't have to log on every tick, otherwise you gonna have huge size of log files that can not be opened with notepad :(. Been there done that.

Get GetLastError on OrderSend(), there's plenty forumer here have a problem that can be simply solved by finding out GetLastError()

Drag stdlib.mq4 from libraries and drop to top of your EA

#include "..\libraries\stdlib.mq4"
       
ticket = OrderSend (...
if (ticket < 0)
   {
    Print (ErrorDescription(GetLastError()));
   }
 
onewithzachy:

Good advice there from RaptorUK. You don't have to log on every tick, otherwise you gonna have huge size of log files that can not be opened with notepad :(. Been there done that.

Get GetLastError on OrderSend(), there's plenty forumer here have a problem that can be simply solved by finding out GetLastError()

Drag stdlib.mq4 from libraries to top of your EA

I really do not like this . . . sorry.

Let me tell you why, when someone posts and says, "help, help, I have error 130" . . many of us knows what it means . . . when someone posts and says . . . "help, help, I have error invalid stops " well that, IMO, is less precise and potentially more ambiguous than simply saying error 130 . . . or a better example might be . . . "help, help I have no error", what they actually mean is . . . "help, help I have error 1 "

From stdlib.mq4

case 1:   error_string="no error";                                                  break;
 
RaptorUK:

I really do not like this . . . sorry.

Let me tell you why, when someone posts and says, "help, help, I have error 130" . . many of us knows what it means . . . when someone posts and says . . . "help, help, I have error invalid stops " well that, IMO, is less precise and potentially more ambiguous than simply saying error 130 . . . or a better example might be . . . "help, help I have no error", what they actually mean is . . . "help, help I have error 1 "

From stdlib.mq4

You're right RaptorUK, I usually log the code not the description. Well let's write it this way

#include "..\libraries\stdlib.mq4"
       
ticket = OrderSend (...
if (ticket < 0 && GetLastError() > 1)
   {
    Print (ErrorDescription(GetLastError()));
   }
 

Or even better, do both . . . then we are both happy ;-)

#include "..\libraries\stdlib.mq4"

int GLError;
       
ticket = OrderSend (...
if ( ticket < 0 )
   {
   GLError = GetLastError(); 
   Print ("Error # ", GLError, " : ", ErrorDescription(GLError));
   }

PS. Your code won't work because the first GetLasteError() call will clear the error . . .

 
RaptorUK:

Or even better, do both . . . then we are both happy ;-)

PS. Your code won't work because the first GetLasteError() call will clear the error . . .

You right again,

LOL, I'm watching MotoGP live Le Mans, so my head obviously not here :)

 
onewithzachy:

You right again,

LOL, I'm watching MotoGP live Le Mans, so my head obviously not here :)

LOL, I know how that works . . . enjoy the race.
 
RaptorUK:

Why aren't you checking your return values ? if you did you could then report the error back to the logs . . . and then you might know what is going on.

Now: 20 May 2012

Also, take a read of this thread: What are Function return values ? How do I use them ?
Reason: