I cant pass mql5 validation

 

I can't pass the MQL5 validation test for my EA.
It keeps giving me this error.
test on EURUSD,H1 (netting)
2020.05.26 12:02:03 failed instant sell 5 EURUSD at 1.09610 sl: 1.19611 tp: 0.99611 [Volume limit reached]
Even though I checked the max and minimum volume for trade and also checked lotstep, here is my order execution function:

void executeBuy(double lots)
{
double Ask=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
double Bid=SymbolInfoDouble(Symbol(),SYMBOL_BID);
double takeprofit= Ask+tp*_Point;
takeprofit = NormalizeDouble (takeprofit,_Digits);

double stoploss = Ask-sl*_Point;
stoploss = NormalizeDouble (stoploss,_Digits);

double orderlot = lots;
orderlot = (int) (orderlot/SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP))* SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP);
orderlot = MathMin (orderlot, SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX));
orderlot = MathMax (orderlot, SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN));

double margin;
if (OrderCalcMargin (ORDER_TYPE_BUY, Symbol(), orderlot, Ask, margin) && margin > AccountInfoDouble (ACCOUNT_MARGIN_FREE)) 
{
return;
}
int buyticket = trade.Buy(orderlot,Symbol(),0,stoploss,takeprofit,NULL);

Print("unable to place buy order. Error: ", trade.ResultRetcodeDescription(),", Code: ", trade.ResultRetcode());
}
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
  • www.mql5.com
Symbol Properties - Environment State - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Please read the market rules and implement the checks described in the article ...

V. Product Testing

  1. Products offered through the Market service are subject to automatic pre-testing. The necessary requirements are described in the articles "The checks a trading robot must pass before publication in the Market" and "Tips for an effective product presentation on the Market".

Articles

The checks a trading robot must pass before publication in the Market

MetaQuotes, 2016.08.01 09:30

Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
 
Fernando Carreiro #:

Please read the market rules and implement the checks described in the article ...

V. Product Testing

  1. Products offered through the Market service are subject to automatic pre-testing. The necessary requirements are described in the articles "The checks a trading robot must pass before publication in the Market" and "Tips for an effective product presentation on the Market".

What value am I supposed to put in the string &description here?

bool CheckVolumeValue(double volume,string &description)
  {
//--- minimal allowed volume for trade operations
   double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
   if(volume<min_volume)
     {
      description=StringFormat("Volume is less than the minimal allowed SYMBOL_VOLUME_MIN=%.2f",min_volume);
      return(false);
     }

//--- maximal allowed volume of trade operations
   double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
   if(volume>max_volume)
     {
      description=StringFormat("Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX=%.2f",max_volume);
      return(false);
     }

//--- get minimal step of volume changing
   double volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);

   int ratio=(int)MathRound(volume/volume_step);
   if(MathAbs(ratio*volume_step-volume)>0.0000001)
     {
      description=StringFormat("Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP=%.2f, the closest correct volume is %.2f",
                               volume_step,ratio*volume_step);
      return(false);
     }
   description="Correct volume value";
   return(true);
  }
 
Abdelrahman Ahmed Mahmoud Ahmed #: What value am I supposed to put in the string &description here?

That parameter is an output parameter, not an input parameter. A value is returned.

EDIT: Remember to also check the SYMBOL_VOLUME_LIMIT property.

 
Fernando Carreiro #:

That parameter is an output parameter, not an input parameter. A value is returned.

EDIT: Remember to also check the SYMBOL_VOLUME_LIMIT property.

OK,thank you!

 
Fernando Carreiro #:

That parameter is an output parameter, not an input parameter. A value is returned.

EDIT: Remember to also check the SYMBOL_VOLUME_LIMIT property.

After I implemented the checks and tried to validate the EA, I keep getting this error

test on EURUSD,H1 (netting) not synchronized with trade server

 
Abdelrahman Ahmed Mahmoud Ahmed #:

After I implemented the checks and tried to validate the EA, I keep getting this error

test on EURUSD,H1 (netting) not synchronized with trade server

If you have studied SymbolInfo.mqh correctly, then your problem "test on EURUSD,H1 (netting) not synchronized with trade server" will be resolved. ^_^