Aurix Exchange

Add Max No Of Orders Code

Add :

After the other functions :

Code:

//|---------count orders

int CountOrders(int Type,int Magic)
{
int _CountOrd;
_CountOrd=0;
for(int i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol())
{
if((OrderType()==Type&&(OrderMagicNumber()==Magic)||Magic==0))_CountOrd++;
}
}
return(_CountOrd);
}

Before the ordersend functions :

Code:

if((CountOrders(OP_BUY,Magic)+CountOrders(OP_SELL,Magic))<MaxOrders)
{

After the ordersend functions :

Code:

}

In the extern parameters :

Code:

extern int MaxOrders=100;//|---------------------maximum orders allowed
 

Aurix Exchange
Top