Cant find problem?

 

Hi, someone using the Tickmill ECN broker from spain has told me my EA Break Even Trader doesnt place the stop loss and take profit when an order is placed onto the chart.

Ive tested it on tickmill and it works okay for me at Tickmill UK ECN. I dont understand why they are getting this problem?   

#property copyright "Stephen J Reynolds"
#property link      "https://www.mql5.com"
#property version   "1.1"
#property strict

// Input variables
extern string SECTION_A = "*** Trade Management Settings ***";
input int StopLoss = 100;   // Stop Loss
input int TakeProfit = 0;   // Take Profit   
input int pMinProfit = 100;    // Minimum Profit 
input int pLockProfit = 0;    // Lock In Profit 

extern string SECTION_B = "*** Profit Alert Settings ***";
input bool ProfitAlert = false;    // Profit Alert
input int ProfitTarget = 500;    // Profit Alert Target

extern string SECTION_C = "*** Alarm Settings ***";
input string soundfile = "alert.wav"; // Soundfile  
input bool playsound = false; // Play Sound
input bool alertbox = false; // Alert Box
input bool sendmail = false; // Send eMail
input bool sendnotification = false;  // Send Mobile

// Event handler
void OnTick()
{                 
   // Stop Loss, Take Profit & Break Even
   for(int order = 0; order <= OrdersTotal() - 1; order++)
   {
      bool select = OrderSelect(order,SELECT_BY_POS); // Order must be selected before it can be processed. Not sure why it cant be in buy or sell each section?
         
      // Adds Buy Stop Loss Take Profit To Buy Order 
      // (If there is no stop loss then here we add the stop loss and take profit levels to our order. If there is a stop loss then this section is ignored.)
      if(OrderType() == OP_BUY  && OrderStopLoss() == 0 && (StopLoss > 0 || TakeProfit > 0))
      {
         // Calculate stop loss & take profit 
         double stopLoss = 0, takeProfit = 0;
         if(StopLoss > 0) stopLoss = OrderOpenPrice() - (StopLoss * _Point);    
         if(TakeProfit > 0) takeProfit = OrderOpenPrice() + (TakeProfit * _Point);   
 
         // Here ive taken away the part of code that makes sure the stop loss is placed above/below stop level
 
         // Modify Order 
         bool modifySLTP = OrderModify(OrderTicket(),0,stopLoss,takeProfit,0);
      }   
      
      // Buy Break Even (Recognises our order then moves stop to break even level when price moves into profit by x amount specified by user)
      if(OrderType() == OP_BUY)
      {
         bool setBreakEvenStop = false;
      
         double breakEvenStop = 0;   
         double currentProfit = 0;

         double orderStopLoss = OrderStopLoss();   
         double minProfit = pMinProfit * _Point;
                  
         // Modify Order For Break Even          
         breakEvenStop = OrderOpenPrice() + (pLockProfit  * _Point); 
         breakEvenStop = NormalizeDouble(breakEvenStop,_Digits);
            
         orderStopLoss = NormalizeDouble(orderStopLoss,_Digits); 
                        
         currentProfit = Bid - OrderOpenPrice();
         currentProfit = NormalizeDouble(currentProfit,_Digits);
         
         static datetime TimeStamp;
 
         if(breakEvenStop > orderStopLoss && currentProfit >= minProfit)
         {
            bool selectBreakEven = OrderModify(OrderTicket(),0,OrderOpenPrice(),OrderTakeProfit(),0);
         }
   
         if(currentProfit > (_Point * ProfitTarget) && ProfitAlert)
         {
            if(TimeStamp != Time[0])
            {
               if(playsound) PlaySound(soundfile);
               if(alertbox) Alert(_Symbol + IntegerToString(_Period) + "Profit on " + OrderSymbol());         
               if(sendmail) SendMail(_Symbol + IntegerToString(_Period) + "Profit!", "Profit on " + OrderSymbol());
               if(sendnotification) SendNotification(_Symbol + IntegerToString(_Period) + "Profit on " + OrderSymbol());  
      
               TimeStamp = Time[0];           
            }
         }        
      }   
        
      // Adds Sell Stop Loss Take Profit To Sell Order      
      if(OrderType() == OP_SELL && OrderStopLoss() == 0 && (StopLoss > 0 || TakeProfit > 0)) // Here using OrderStopLoss() stops the OrderModify() function being used again. (To stop SL TP being moved)       
      {                                                                                                        
         // Calculate stop loss & take profit                       
         double stopLoss = 0, takeProfit = 0;
         if(StopLoss > 0) stopLoss = OrderOpenPrice() + (StopLoss * _Point);
         if(TakeProfit > 0) takeProfit = OrderOpenPrice() - (TakeProfit * _Point);

         // Modify Order
         bool modifySLTP = OrderModify(OrderTicket(),0,stopLoss,takeProfit,0);
      }      
      
      // Sell Break Even
      if(OrderType() == OP_SELL)
      {
         bool setBreakEvenStop = false;
      
         double breakEvenStop = 0;   
         double currentProfit = 0;

         double orderStopLoss = OrderStopLoss();   
         double minProfit = pMinProfit * _Point;
           
         // Modify Order For Break Even               
         breakEvenStop = OrderOpenPrice() - (pLockProfit  * _Point); 
         breakEvenStop = NormalizeDouble(breakEvenStop,_Digits);
             
         orderStopLoss = NormalizeDouble(orderStopLoss,_Digits); 
                 
         currentProfit = OrderOpenPrice() - Ask;  // Remember Bid and Ask are the spread apart if 20pts thats 20pts above Bid line
         currentProfit = NormalizeDouble(currentProfit,_Digits);
         
         static datetime TimeStamp;  

         if(breakEvenStop < orderStopLoss && currentProfit >= minProfit)
         {
            bool selectBreakEven = OrderModify(OrderTicket(),0,OrderOpenPrice(),OrderTakeProfit(),0);
         }
         
         if(currentProfit > (_Point * ProfitTarget) && ProfitAlert)
         {
            if(TimeStamp != Time[0])
            {
               if(playsound) PlaySound(soundfile);
               if(alertbox) Alert(_Symbol + IntegerToString(_Period) + "Profit on " + OrderSymbol());         
               if(sendmail) SendMail(_Symbol + IntegerToString(_Period) + "Profit!", "Profit on " + OrderSymbol());
               if(sendnotification) SendNotification(_Symbol + IntegerToString(_Period) + "Profit on " + OrderSymbol());  
      
               TimeStamp = Time[0];           
            }
         }          
      }              
   } 
}
Reason: