Reply

Total number of open trades

1 replies

huangwh88

Customer, bbp_participant, community, 113 replies.

Visit profile

4 years ago #250769

Hi,

Is it possible to have a rule that checks the total number of open trades in the account (not just the EA)? For example, IF number of open trades in the account < 3, then execute action.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

4 years ago #250775

Hello,

EA Wizard does not include such function but it can be easily added as the following custom function (include at the end into /code/CustomFunctions.mq4)

int getOpenOrdersCount() {

int open_orders = 0;

for( int j = 0; j < Total; j ++){
OrderSelect(j, SELECT_BY_POS, MODE_TRADES);
if(OrdersTotal()==0) break;
if(OrderType()==OP_BUY) open_orders++; continue;
if(OrderType()==OP_SELL) open_orders++; continue;
}

return(open_orders);

}

and refer in EA Wizard as shown in the screenshot attached

Attachments:
You must be logged in to view attached files.

0

Viewing 1 replies (of 1 total)