Count the TOTAL pending order for all symbols, because mine only count current chart

 

this is what i've been using:

for (int j = 0; j < OrdersTotal(); j++) {
      if ((OrderTicket = OrderGetTicket(j)) > 0) {
         if ((OrderGetInteger(ORDER_TYPE) == ORDER_TYPE_BUY_LIMIT)) {
                 CountBuyLim++;
         }
      }
}

and it is succesfully count the number on Buy Limit with its current chart attached.

for example: i have 1 buylim on XAUUSD and 1 buylim on EURUSD. if i attach this EA on XAUUSD, it only count 1.  if i attach this EA on GBPUSD, it count 0. so this code only count pending order on its current chart. how to count pending order on ALL symbols? or is this normal?

 
Abdul Arief Bogie Ardianto:

this is what i've been using:

and it is succesfully count the number on Buy Limit with its current chart attached.

for example: i have 1 buylim on XAUUSD and 1 buylim on EURUSD. if i attach this EA on XAUUSD, it only count 1.  if i attach this EA on GBPUSD, it count 0. so this code only count pending order on its current chart. how to count pending order on ALL symbols? or is this normal?

It is only counting pending Buy Limit orders not all pending orders...  check your order types because it does work from other charts.

 
Paul Anscombe #:

It is only counting pending Buy Limit orders not all pending orders...  check your order types because it does work from other charts.

yes it is. i forget to clarify the question. it indeed only counts buy limit orders, i can edit that later. what i want to do is count buy limit for every symbols. but this code result is depending on the chart it is attached to.

so above example applies: let's say i have 1 buylim on XAUUSD and 1 buylim on EURUSD. if i attach this EA on XAUUSD, it only count 1.  if i attach this EA on GBPUSD, it count 0. i want the result is 2, no matter what chart it is. so this code only count pending order on its current chart. in conclusion, it only count buy limit on the chart symbol EA is attached to, not all buy limit on all symbols

 
Abdul Arief Bogie Ardianto #:

yes it is. i forget to clarify the question. it indeed only counts buy limit orders, i can edit that later. what i want to do is count buy limit for every symbols. but this code result is depending on the chart it is attached to.

so above example applies: let's say i have 1 buylim on XAUUSD and 1 buylim on EURUSD. if i attach this EA on XAUUSD, it only count 1.  if i attach this EA on GBPUSD, it count 0. i want the result is 2, no matter what chart it is. so this code only count pending order on its current chart. in conclusion, it only count buy limit on the chart symbol EA is attached to, not all buy limit on all symbols

no, it works independent of chart symbol. 

you either have different pending orders on those other charts or are not calling this function on all occassions.

remember a Buy Limit is different to a Buy Stop

use some print statements to identify the pending orders that it finds and counts.