Compare the difference between closed order time plus added minutes with current time

 

I am having a challenge in comparing CurrentTime and closed deal time from history after i add 10 minutes or so. if i use the if statement i am getting the same results true. Where am i wrong. Or is there a better was to check if last loss order was closed in loss and then add 10 minutes before opening a new order. Check code

string GetLastProfit()
{
   uint TotalNumberOfDeals = HistoryDealsTotal();
   ulong TicketNumber = 0;
   long OrderType, DealEntry;
   double OrderProfit = 0;
   string MySymbol = "";
   string PositionDirection = "";
   string MyResult = "";
   datetime OrderTime;
   long DealMagicNumber = 0;
   
   //get the history using historyselect first
   HistorySelect(0,TimeCurrent());
   
   //go through all the deals 
   for(uint i=0; i < TotalNumberOfDeals; i++)
   {
      //we look for ticket number
      if((TicketNumber = HistoryDealGetTicket(i))>0)
      {
         //Get the order Profit
         OrderProfit = HistoryDealGetDouble(TicketNumber,DEAL_PROFIT);
         
         //Get the order Type
         OrderType = HistoryDealGetInteger(TicketNumber,DEAL_TYPE);
         
         //Get the time when order was executed
         OrderTime = (datetime)HistoryDealGetInteger(TicketNumber,DEAL_TIME);
         
         //Get the magic number for the deal
         DealMagicNumber = HistoryDealGetInteger(TicketNumber,DEAL_MAGIC);
         
         //Get the Symbol
         MySymbol = HistoryDealGetString(TicketNumber,DEAL_SYMBOL);
         
         //Get the entry type to check for close type
         DealEntry = HistoryDealGetInteger(TicketNumber, DEAL_ENTRY);         
         
         //Add Minutes to OrderTime         
         datetime AddedTime = OrderTime + 3600;
         
         //Current Time
         datetime CurrentTime = TimeCurrent();
         
         //Check if currency pair match
         if(MySymbol==_Symbol)
         
         //If buy or sell
         if(OrderType==ORDER_TYPE_BUY || OrderType == ORDER_TYPE_SELL)
         
         //if order was closed
         if(DealEntry == 1)
         
         if(CurrentTime>AddedTime)
         {
            MyResult = "Time Now: "+CurrentTime+ " Order Time: "+OrderTime+" Added Time : "+ AddedTime ;
         } 
      }
   }
   
   return MyResult;   
   
}
Reason: