Getting error 1006 on the live server but not on the demo sever ordermodify(), partialclose()

 

Here is the Code

 void partialClose(int num)
  {
    //Print("partial close");
    for(int i=PositionsTotal()-1; i>=0; i--)
      {
         int ticket =PositionGetTicket(i);
       
      
      if(num == 1)
       {
          //Print(ticket);
         if (PositionGetDouble(POSITION_VOLUME)== 0.08)
        {
           //Print("correct ticket");
           
           
            if (!trade.PositionClosePartial(_Symbol,0.05,5)) {
                Print(PositionGetSymbol(i), "Position Partial Close() failed. Return code= " + i, trade.ResultRetcode(), ". Code description: ", trade.ResultRetcodeDescription());
            }
            else {
                Print(PositionGetSymbol(i), "Position Partial Close() successful. Return code=", trade.ResultRetcode(), " (", trade.ResultRetcodeDescription(), ")");
            }
           
        } 
      
        }
        
         if(num == 2)
       {
          Print(ticket);
         if (PositionGetDouble(POSITION_VOLUME)== 0.19)
        {
          // Print("correct ticket");
           
           
            if (!trade.PositionClosePartial(_Symbol,0.18,5)) {
                Print(PositionGetSymbol(i), "Position Partial Close() failed. Return code= " + i, trade.ResultRetcode(), ". Code description: ", trade.ResultRetcodeDescription());
            }
            else {
                Print(PositionGetSymbol(i), "Position Partial Close() successful. Return code=", trade.ResultRetcode(), " (", trade.ResultRetcodeDescription(), ")");
            }
           
        } 
      
        }
        
        
        
        
     }
  
     
  }
  
  
   
  
  void adjustStops()
  {
   
   Print("adjust stops");
    for(int i=PositionsTotal()-1; i>=0; i--)
      {
          int ticket =PositionGetTicket(i);
          int type = positionInfo.PositionType();
  
    if(type == 0)
     {
                  
     
                if(trade.PositionModify(_Symbol,Ask+100*_Point,(Ask+800*_Point)))
                    {
                      Print(" order modify buy stop succesful"); 
                                           
                     }
                     else
                    {
                     Print("The position modify request for buy could not be completed. Error: " + GetLastError());
                                        
                    }
     
     
     }
     
     
     
     
     if(type == 1)
     {
     
                   
                if(trade.PositionModify(_Symbol,(Bid-100*_Point),(Bid-800*_Point)))
                   {
                   Print(" order modify sell stop succesful "); 
                                           
                     }
                     else
                      {
                    Print("The position modify request for sell could not be completed. Error: " + GetLastError());
                                        
                      }
     
     
     }
  
    }
  
  }


The code above as part of the EA compiles and has no errors. In fact when I run it on the demo server it both order modify(adjust stops)  and partial close

run without any errors (on an ECN account). However once on the trading (live) server I get and error 10006  for the return code on the partial stops . in both cases the   GetLastError() returns 0

spoken to the brokers, the Customer support are not of much help.

does any one have an ideas


Regards



Thanks

 
cjduke:

Here is the Code


The code above as part of the EA compiles and has no errors. In fact when I run it on the demo server it both order modify(adjust stops)  and partial close

run without any errors (on an ECN account). However once on the trading (live) server I get and error 10006  for the return code on the partial stops . in both cases the   GetLastError() returns 0

spoken to the brokers, the Customer support are not of much help.

does any one have an ideas


Regards



Thanks

Duplicate of 

https://www.mql5.com/en/forum/19197

what does result code 10006 suggest?
what does result code 10006 suggest?
  • 2014.01.29
  • www.mql5.com
I am using CTrade class and sending a buylimit request. but I get the result of 1006! I am using this to get the result code: Print(trade...
Reason: