Download MetaTrader 5
To add comments, please log in or register
Looking for like-minded people? You will find lots of them on the Forum!
Mark James Carlton
106
Mark James Carlton 2013.04.26 10:05 

Hi All,

 

I believe i have a bug in Build 482, 

If I open an order, and do partial closes using my EA after doing these several times, OrdersTotal reports that there are NO open tickets, but there is.

Anyone had this issue, any idea how else I can know if there is an open order? 

I run over 300 MT4s at a time and rely on OrdersTotal to know if any still have open trades, this is an extremely dangerous situation for me.

I have never had this problem in 4 years until build 482.

 

Thanks

Simon Gniadkowski
Moderator
17972
Simon Gniadkowski 2013.04.26 10:18  
Bremsford:

Hi All,

 

I believe i have a bug in Build 482, 

If I open an order, and do partial closes using my EA after doing these several times, OrdersTotal reports that there are NO open tickets, but there is.

Anyone had this issue, any idea how else I can know if there is an open order? 

I run over 300 MT4s at a time and rely on OrdersTotal to know if any still have open trades, this is an extremely dangerous situation for me.

I have never had this problem in 4 years until build 482.

Please provide a script/EA and instructions to reproduce this issue.
Mark James Carlton
106
Mark James Carlton 2013.04.26 10:32  
RaptorUK:
Please provide a script/EA and instructions to reproduce this issue.


Thank you for the quick response, My code is complex and spread across multiple servers, so no point in giving you that. I will write something to reproduce it and send to you ASAP.

Thanks 

Mark James Carlton
106
Mark James Carlton 2013.04.26 14:03  

Hi,

Took a while but have worked out that the order needs to be in profit for OrdersTotal() to report wrong and I also think the lot size below 0.5 but have not tested enough to confirm that bit. I have run this now 5 times and each time OrdersTotal() reports 0 orders and you can clearly see the order is still there.

I have attached 2 EA´s, the first "OrdersTotal Check.mq4", will enter an order at 1 lot, wait for it to get into profit, then on each tick, reduce the lot size by 0.01

The second EA  "OrdersTotalCheck 2.mq4", monitors orderstotal and alerts when it is 0

To load these, add "OrdersTotal Check.mq4" to a chart, once it has entered an order, open a second chart and add  "OrdersTotalCheck 2.mq4"

Then its just a matter of waiting for the order to go in to profit and watching the lot size decrease. Eventually you should get an alert to say that Orderstotal=0 and you will be able to see the order is still there.

 

Thanks

PS it will not let me add 2 files, I´ll send this then add the other 

Files:
Mark James Carlton
106
Mark James Carlton 2013.04.26 14:03  
Second File 
Files:
Simon Gniadkowski
Moderator
17972
Simon Gniadkowski 2013.04.26 14:39  
Bremsford:

Hi,

Took a while but have worked out that the order needs to be in profit for OrdersTotal() to report wrong and I also think the lot size below 0.5 but have not tested enough to confirm that bit. I have run this now 5 times and each time OrdersTotal() reports 0 orders and you can clearly see the order is still there.

I have attached 2 EA´s, the first "OrdersTotal Check.mq4", will enter an order at 1 lot, wait for it to get into profit, then on each tick, reduce the lot size by 0.01

The second EA  "OrdersTotalCheck 2.mq4", monitors orderstotal and alerts when it is 0

To load these, add "OrdersTotal Check.mq4" to a chart, once it has entered an order, open a second chart and add  "OrdersTotalCheck 2.mq4"

Then its just a matter of waiting for the order to go in to profit and watching the lot size decrease. Eventually you should get an alert to say that Orderstotal=0 and you will be able to see the order is still there.

I'll take a look at this properly in a little while,  but one comment,  you should not be sleeping in init(),  move the check of OrdersTotal() to start(), it is expected that  init() will execute and be returned from in a few seconds,  it has been stated by others that if this does not happen "strange things" can happen.
Mark James Carlton
106
Mark James Carlton 2013.04.26 15:03  
RaptorUK:
I'll take a look at this properly in a little while,  but one comment,  you should not be sleeping in init(),  move the check of OrdersTotal() to start(), it is expected that  init() will execute and be returned from in a few seconds,  it has been stated by others that if this does not happen "strange things" can happen.


Thanks for the tip, my main code does not use init(), i just used in this example, so understand the point, but sure that´s not the issue

 

Thanks 

Ovo Cz
2988
Ovo Cz 2013.04.26 17:14  

Just an idea. I did not try, though.

If I see you checking for OrdersTotal() in a loop, I would try to add RefreshRates() to the cycle. Just to ensure they did not include the OrdersTotal() to this refresh in 482.

Simon Gniadkowski
Moderator
17972
Simon Gniadkowski 2013.04.26 17:33  
Bremsford:

Hi,

Took a while but have worked out that the order needs to be in profit for OrdersTotal() to report wrong and I also think the lot size below 0.5 but have not tested enough to confirm that bit. I have run this now 5 times and each time OrdersTotal() reports 0 orders and you can clearly see the order is still there.

I have attached 2 EA´s, the first "OrdersTotal Check.mq4", will enter an order at 1 lot, wait for it to get into profit, then on each tick, reduce the lot size by 0.01

The second EA  "OrdersTotalCheck 2.mq4", monitors orderstotal and alerts when it is 0

To load these, add "OrdersTotal Check.mq4" to a chart, once it has entered an order, open a second chart and add  "OrdersTotalCheck 2.mq4"

Then its just a matter of waiting for the order to go in to profit and watching the lot size decrease. Eventually you should get an alert to say that Orderstotal=0 and you will be able to see the order is still there.

 

Thanks

PS it will not let me add 2 files, I´ll send this then add the other 

I get the alert when the lot size is over 0.9 . . .  I suspect you may be calling OrdersTotal()  too often.
GreenMoney
379
GreenMoney 2013.04.26 17:54  
RaptorUK:
... it is expected that  init() will execute and be returned from in a few seconds

See my test to the contrary here.

it has been stated by others that if this does not happen "strange things" can happen. 

Could you tell me where that was said and under what circumstances?  Thanks.  :)

Simon Gniadkowski
Moderator
17972
Simon Gniadkowski 2013.04.26 19:01  
Thirteen:

See my test to the contrary here.

Could you tell me where that was said and under what circumstances?  Thanks.  :)

For example: https://www.mql5.com/en/forum/133615
/ /123
To add comments, please log in or register