Descripition:
The class COrdersCounter was developed for counting of the orders with different filters: by symbol of currency, Magic Number, either closed, either opened orders.
Below is description of the public methods of this class.
Constructors:
Method |
Description |
---|---|
 COrdersCounter(void) | Constructor by default. |
COrdersCounter(int magic, string symbol, int counter_mode = MODE_TRADES) | Parameters: magic – integer value of Magic Number for for the filtering of the orders. When magic = 0 is not used. symbol – symbol of the instrument. When symbol = “” is not used. counter_mode – the pool of the orders (either closed, either opened orders). Allows 2 values: MODE_TRADES (by default) – opened orders, MODE_HISTORY – closed orders. |
Methods:
Method |
 Description |
---|---|
void refreshData(void) | The method renews data for orders. This method must called before the calling getOrdersCount(), getTotalProfit(), getMarketVolume(), getTotalVolume(). |
int getOrdersCount(int type) | The method returns orders count of defined type. Parameters: Â type – type of the orders. Allowed values: Â OP_BUY – market buy orders, Â OP_SELL – market sell orders, Â OP_SELLLIMIT – sell limit orders, Â OP_BUYLIMIT – buy limit orders, Â OP_SELLSTOP – sell stops orders, Â OP_BUYSTOP – buy stop orders. Â When type = -1, the method will return total count of all orders. |
int getLastOrder() | Returns ticket number of last closed/opened order from the retrieved list. |
int getFirstOrder() | Returns ticket number of first closed/opened order from the retrieved list. |
ProfitData getTotalProfit() | Returns an instance of the struct ProfitData, containing total profit/loss of the retrieved list. The struct ProfitData contains fields: double currency – profit/loss in currency |
double getMarketVolume() | Â Returns the total volume of the market trades of the retrieved list. |
double getTotalVolume() | Â Returns the total volume for all orders of of the retrieved list. |
void setMagicNumber(int magic) |  Sets Magic Number value. Parameters: magic – new value for Magic Number. |
void setSymbol(string symbol) | Â Sets Symbol value. Parameters: symbol – new symbol value of currency. |
void setMode(int mode) | Â Set pool. Parameters: mode – the pool type: MODE_TRADES – opened orders, MODE_HISTORY – closed orders. |
int getMagicNumber() | Â Returns value of magic (Magic Number) for the filtering of the orders. |
string getSymbol() | Â Returns value of symbol. |
int getMode() | Â Return type of current pool for orders filtering: MODE_TRADES – opened orders, MODE_HISTORY – closed orders. |