Hello,
Code to count orders :
OP_ALL is not working
OP_ALL = All the orders (BUY + SELL + BUYLIMIT + SELLLIMIT + BUYSTOP + SELLSTOP)
OP_ALL constant does not exist. Where did you get that?
Than how can i achieve the result i want without making new function code?. If i want total number of orders, How i can do this?.
I can do this by writing new function code like this :
int trades_count(int trade_count_magic) { int count_0 = 0; for(int pos_4 = 0; pos_4 < OrdersTotal(); pos_4++) { OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol() != Symbol() || OrderMagicNumber() != trade_count_magic) continue; count_0++; } return count_0; } trades_count(5555);
But this will be function overloading. and it excess of code and decrease EA performance. How i can achieve the result without adding new function?
Than how can i achieve the result i want without making new function code?. If i want total number of orders, How i can do this?.
I can do this by writing new function code like this :
But this will be function overloading. and it excess of code and decrease EA performance. How i can achieve the result without adding new function?
why don't you use the documentation for once, you can get total orders, but if you want a subset of that total you will have to write a function to do it.

Than how can i achieve the result i want without making new function code?. If i want total number of orders, How i can do this?.
I can do this by writing new function code like this :
But this will be function overloading. and it excess of code and decrease EA performance. How i can achieve the result without adding new function?
#define OP_ALL -1 int trade_count_ordertype(int trade_count_ordertype_value, int trade_count_ordertype_magic) { int count_4 = 0; for(int pos_8 = 0; pos_8 < OrdersTotal(); pos_8++) { OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol() != Symbol() || OrderMagicNumber() != trade_count_ordertype_magic) continue; if(trade_count_ordertype==OP_ALL || trade_count_ordertype_value == OrderType()) count_4++; } return count_4; }
Hi
Perhaps it was defined somewhere else in this code you have seen.
Those are simply converted to numbers while using as “indexes” for arrays - so when you define this as OP_ALL=10, and then fill the array for this index properly you can use this as a global counter for all trades.
Best Regards

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Code to count orders :
OP_ALL is not working
OP_ALL = All the orders (BUY + SELL + BUYLIMIT + SELLLIMIT + BUYSTOP + SELLSTOP)