//+------------------------------------------------------------------+ //| Закрыть по общему профиту.mq4 | //| Krokus | //| http://www.liteforex.net | //+------------------------------------------------------------------+ #property copyright "Krokus" #property link "http://www.liteforex.net" #property show_inputs extern double Profit=20; extern int Slipage=3; //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //---- if(AccountProfit()=0;i--) { if(!OrderSelect(i,SELECT_BY_POS))continue; if(OrderType()==OP_SELL ) { OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),Slipage,Red); if(GetLastError()==135) {RefreshRates();i++;} continue; } if( OrderType()==OP_BUY ) { OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),Slipage,Red); if(GetLastError()==135) {RefreshRates();i++;} continue; } } //---- return(0); } //+------------------------------------------------------------------+