max_volume error causing product validation failure when volume is restricted to 9 lots the product passes validation.?

 

When the product was not validated the error was failed instant sell 10 GBPUSD [Volume limit reached].

//Checks before any position is opened

bool CheckLotForMinMax(double Trade)
  {
   double min_volume = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN),_Digits);

   double max_volume = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX),_Digits);

   bool Check = true;

   if(Trade > max_volume)
     {

      Check = false;
      
      Trade = max_volume;
     }

   if(Trade < min_volume)
     {

      Check = false;
      
      Trade = min_volume;
     }

   return Check;
  }


//When this is added the product validation passes
if(Trade > 9)
 {
   Trade = 1;
 }




 
Benrashi Sagev Jacobson: the error was failed instant sell 10 GBPUSD [Volume limit reached].

Your function returns true/false. Your problem is with the caller's code.

 
Brokers define the max volume limit. As it seems your code does not respect this limit given by the trade server. That's why you receive the error in the first place.
 
There are limits for a single deal (SYMBOL_VOLUME_MAX) and for the total position (+pending orders) (SYMBOL_VOLUME_LIMIT). Your EA might be hitting the latter.
 
Haruto Rat #:
There are limits for a single deal (SYMBOL_VOLUME_MAX) and for the total position (+pending orders) (SYMBOL_VOLUME_LIMIT). Your EA might be hitting the latter.
Your correct comparing the amount of orders to symbol_volume_limit caused the ea to pass validation took a few hours. Do you like the EA and if not why?
Reason: