11. Buy (Del)

1 Views
0 Downloads
0 Favorites
11. Buy (Del)
//+---------------------------------------------------------+
//           Ñêðèïò óáèð¸ò âñå Buy ïî èíñòðóìåíòó           |
//+---------------------------------------------------------+
void start(){
PlaySound("tick.wav");
bool s = false;
double b = AccountBalance();
int i=0;
for(;i<OrdersTotal();i++)
{//+---------------------------------------------------------------------+for
OrderSelect(i,SELECT_BY_POS);
 if(OrderSymbol()!= Symbol())continue;
 if(OrderType()>0)continue;
 s=true;
 int Ticket = OrderTicket();
 double Lots = OrderLots();
 double Price=NormalizeDouble(Bid,Digits);
//+----------------------------------------------------------------------+
 OrderClose(Ticket,Lots,Price,3);
 int error = GetLastError();
 if(error==6){Alert("Íåò ñâÿçè");return;}
 if(error==132){Alert("Ðûíîê çàêðûò");return;}
   RefreshRates();
   i--;
 }//+--------------------------------------------------------------------+for
if(s)Alert("PROFIT :   ",AccountBalance()-b);else Alert("Íåò îðäåðîâ Buy");
PlaySound("ok.wav");
 return;}

Comments