Download MetaTrader 5

OrdersTotal() meaning

To add comments, please log in or register
gatornuke
354
gatornuke  

This should be an easy question:

Does the OrdersTotal() function return the number of open orders for whatever chart the EA is loaded on, or does it return the total amount for the account? I.E., If I have the same EA loaded on say 4 different charts, and only one of them launched orders, are the other EAs going to return OrdersTotal()>0 as well?

And, yes, i looked in the documentation, but it didn't specifically address this.

qjol
3245
qjol  

no, OrdersTotal() even on a chart without orders return the total orders in terminal

Van Dau
11
Van Dau  
qjol:

no, OrdersTotal() even on a chart without orders return the total orders in terminal

No, OrdersTotal() return total all opening order (contents pending orders) in terminal (flatform).

int OrdersTotal( )
Returns market and pending orders count.

Ex: If you are open 1 buy order at EURUSD, and 1 sell order at GBPUSD, and 1 sell limit order at USDJPY.
==> Total=OrdersTotal();
==> //Return: Total=3

Good luck.
whroeder1
16574
whroeder1  
Total of all open (filled and pending) orders. That's why you must filter
    for(int pos = OrdersTotal() - 1; pos >= 0; pos--) if (
        OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
    &&  OrderMagicNumber() == magic.number              // my magic number
    &&  OrderSymbol()      == Symbol() ){               // and symbol
gatornuke
354
gatornuke  

Thanks

Abdul Salam
3010
Abdul Salam  
very informative i have confusion over OrdersTotal function and this discussion clears my concept too
To add comments, please log in or register