Count number of oders

To add comments, please log in or register
shaikh_shafique
25
shaikh_shafique  

Hello, 

Currently i am trying to limit number of order to 4,  opened by EA using OrderTotal() but still EA opens more then 4 orders 

here is snippet 

if( OrderTotal() <=4)

{

//here goes code 

Please help 

Documentation on MQL5: Trade Functions / OrdersTotal
Documentation on MQL5: Trade Functions / OrdersTotal
  • www.mql5.com
Do not confuse current pending orders with positions, which are also displayed on the "Trade" tab of the "Toolbox" of the client terminal. An order is a request to conduct a transaction, while a position is a result of one or more deals.
Keith Watford
Moderator
25504
Keith Watford  
MQL4 or MQL5 ?
shaikh_shafique
25
shaikh_shafique  
Keith Watford:
MQL4 or MQL5 ?
MT4 
Keith Watford
Moderator
25504
Keith Watford  
shaikh_shafique:
MT4 

In future please post in the correct section.

I will move your topic to the MQL4 and Metatrader 4 section.

Please edit your post and

use the code button (Alt+S) when pasting code

if( OrderTotal() <=4)

{

//here goes code 

} 
What is OrderTotal() ??
shaikh_shafique
25
shaikh_shafique  
Keith Watford:

In future please post in the correct section.

I will move your topic to the MQL4 and Metatrader 4 section.

Please edit your post and

use the code button (Alt+S) when pasting code

What is OrderTotal() ??
It is function to get totalorders in mt4
Keith Watford
Moderator
25504
Keith Watford  
shaikh_shafique:
It is function to get totalorders in mt4

Do you mean OrdersTotal() ??

shaikh_shafique
25
shaikh_shafique  
Keith Watford:

Do you mean OrdersTotal() ??


YEP

William Roeder
23241
William Roeder  
  1. Don't double post! You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2017.07.19

  2. shaikh_shafique: YEP
    Don't post code that won't even compile. If you want help with your code, post your code.
Keith Watford
Moderator
25504
Keith Watford  
shaikh_shafique:

Do not double post!

I have deleted your duplicate topic.

Keith Watford
Moderator
25504
Keith Watford  
if( OrdersTotal() <=4)

{

//If there are 5 or more orders currently open this block of code will not be executed
//So if new orders are opened and there are already 5 orders currently open, the new orders are not being opened in this block of code. 

} 

If you want to limit it to no more than 4 currently open orders you should use

if( OrdersTotal() <4)
shaikh_shafique
25
shaikh_shafique  
Thanks will try this :-) 
To add comments, please log in or register