Live and Demo

 

Hello,

 I recently opened a live account for the first time. And between the live and demo account, the EA is placing the orders the same.

But when it comes to Closing the trade, only the demo account seems to close where it is suppose to, and my live account is not closing (still testing but definitely not closing where it is suppose to). 

I am using OrderModify() to modify the SL value to close. The code is suppose to execute OrderModify() when certain conditioned are met, and the conditions for close trade are met in live account. But in the Journal section there is no trace of any OrderModify(). No errors, Nothing.

I am wondering if my broker has restrictions on trailing stops or the OrderModify() function on just live accounts. Is that a possibility? 

The VPS is not the fastest but since the demo account is closing fine, I think it is sufficiently fast enough. 

 Any leads that can help me figure this is out, greatly appreciated! Thanks.

 

Scott 

 
XBRO16:

Hello,

 I recently opened a live account for the first time. And between the live and demo account, the EA is placing the orders the same.

But when it comes to Closing the trade, only the demo account seems to close where it is suppose to, and my live account is not closing (still testing but definitely not closing where it is suppose to). 

I am using OrderModify() to modify the SL value to close. The code is suppose to execute OrderModify() when certain conditioned are met, and the conditions for close trade are met in live account. But in the Journal section there is no trace of any OrderModify(). No errors, Nothing.

I am wondering if my broker has restrictions on trailing stops or the OrderModify() function on just live accounts. Is that a possibility? 

The VPS is not the fastest but since the demo account is closing fine, I think it is sufficiently fast enough. 

 Any leads that can help me figure this is out, greatly appreciated! Thanks.

 

Scott 

You could try to print the return value of ordermodify or print the last error just after the modification to see what is the problem.

https://www.mql5.com/en/docs/constants/errorswarnings/errorcodes

Documentation on MQL5: Standard Constants, Enumerations and Structures / Codes of Errors and Warnings / Runtime Errors
Documentation on MQL5: Standard Constants, Enumerations and Structures / Codes of Errors and Warnings / Runtime Errors
  • www.mql5.com
Standard Constants, Enumerations and Structures / Codes of Errors and Warnings / Runtime Errors - Reference on algorithmic/automated trading language for MetaTrader 5
 
I think @Marco vd Heijden is completely right but I'm suspecting that if you don't see anything in the Expert log, that variable is most-likely not even getting set. In case the output of OrderModify() is NULL/empty and doesn't return an error code, I would place my own additional checks in and around where OrderModify gets set to see where the code is at that time. I'm not 100% sure but I think you could use the Strategy Tester and back-test this issue specifically, instead of having to wait for the "conditions" to be met again.
Reason: