//+------------------------------------------------------------------+ //| close-all-orders.mq4 | //| Copyright © 2005, Matias Romeo. | //| (Hack by rosst@yahoo.com) Custom Metatrader Systems. | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, Matias Romeo." #property link "mailto:matiasDOTromeoATgmail.com" extern int ProfitTarget = 100; // Profit target in dollars datetime BarTime; string TotalAP = ""; //################## int start() { int cnt, total = OrdersTotal(); for(int i=total-1;i>=0;i--) { OrderSelect(i, SELECT_BY_POS); int type = OrderType(); bool result = false; switch(type) //################## ORDER CLOSURE ################################################### // If Orders are in force then check for closure against the total account profit level if (AccountProfit() >= 100) { TotalAP = "closeall"; } //start closing orders; { total=OrdersTotal(); if(total>0) { for(cnt=0;cnt