Take a break when I lose my deal.

 
I'd like to take a break when I lose my deal.

I've made a code, but it doesn't work properly.

I'd like to put it in terms of purchase.

Can you explain the above code?


extern double initial_Lots = 0.1; 
//+------------------------------------------------------------------+
//| exter Var                                                    |
//+------------------------------------------------------------------+
extern bool LastOrderCon = True;
extern int Pause_time = 12;
//+------------------------------------------------------------------+






//+------------------------------------------------------------------+
bool LastOrder()
{
   if(OrdersHistoryTotal()>0) 
    {
    OrderSelect(OrdersHistoryTotal()-1, SELECT_BY_POS, MODE_HISTORY);
    if(OrderProfit() < 0)
       {
         if(TimeCurrent() < OrderCloseTime()+Pause_time*60*60 ){
            LastOrderCon =False;
            }
            OrderSelect(OrdersHistoryTotal()-2, SELECT_BY_POS, MODE_HISTORY);
            if(OrderProfit() < 0)
              {
               if(TimeCurrent() < OrderCloseTime()+Pause_time*2*60*60 ){
                  LastOrderCon =False;
                  }
                    OrderSelect(OrdersHistoryTotal()-3, SELECT_BY_POS, MODE_HISTORY);
                     if(OrderProfit() < 0)
                    {
                     if(TimeCurrent() < OrderCloseTime()+Pause_time*14*2*60*60 ){
                        LastOrderCon =False;
                        }    
                     if(TimeCurrent() >= OrderCloseTime()+Pause_time*14*2*60*60){
                     LastOrderCon =True;
                     }
              }   
                     
            if(TimeCurrent() >= OrderCloseTime()+Pause_time*2*60*60){
               LastOrderCon =True;
               }
              }
         if(TimeCurrent() >= OrderCloseTime()+Pause_time*60*60){
            LastOrderCon =True;
            }
              
       } 
      if(OrderProfit() >= 0)
      {
            LastOrderCon =True;
      }
      
      }
    
return(LastOrderCon);    
 }


 
Order after a certain amount of time
Order after a certain amount of time
  • 2017.10.28
  • www.mql5.com
Soon after the loss occurs, the order will go further and further losses will occur...