//+------------------------------------------------------------------+ //| Çàêðûòü ïî îáùåìó ïðîôèòó.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()<Profit) return(0); int t=OrdersTotal(); for(int i=t-1;i>=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); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Checks for the total of open orders
It Closes Orders by itself
Other Features: