Automatic Validation for expert advisors to be published on the Market

 

Hi people,

if a good number of EAs are on the Market , so i think many people has passed the Automatic Validation .

My EA does not give errors on the backtester, but when validating, it gave errors that now were solved. In this moment, i am blocked on another error : it tests EURUSD H1 with success, then it tests NZDUSD H1 (WHY????) giving those damned lines:

test on EURUSD,H1 strategy tester report 1 total trades test on NZDUSD,H1 2017.02.03 13:00:00 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:00 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:00 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:00 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:02 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:02 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:02 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:02 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:04 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:04 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:04 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:04 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:05 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:05 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:05 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:05 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:05 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:05 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:05 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:05 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 2017.02.03 13:00:06 CONSTANTA_01 NZDUSD,H1: OrderSend error 131 there are no trading operations

ok, i am very tired of this errors. Neither available articles on Forum, or Suppor did not help. Now i send you some code and maybe someone can say why that error appears. As you can see, the portions listed here contain control functions (lot optimization, check money, check min max lot) so Error131 is unknown reason. Why does the automatic validation work on NZDUSD too?
#property version "1.00"
#property strict 

//---- input parameters
int MagicNumber=15021987;
int Stop_Loss=360; //360
int TakeProfit=900; //650
extern string M_M2_M3="Defaults 1.8_2.5_4.0";
extern  double M = 2.0;  //M
extern  double M2 = 2.0;  //M2
extern  double M3 = 2.0;  //M3
[.......]
double trailstop = 20;
double ProfitStep1 = 0.003;
double ProfitStep2 = 0.014;
double ProfitStep3 = 0.027;
bool Trail = true;
double PipValue;
extern double MaximumRisk=0.05;
double DecreaseFactor=3;
double Distance1 = 0.005; //0.005
double Distance2 = 0.004; //0.004
double Distance3 = 0.003; //0.003
double Distance4 = 0.002; //0.002
double lot;
int ShortEma= 21;   
int LongEma = 99; 
[..........]

extern string    TimeSettings="Recommended Operativity:09-18 UTC+2";
extern int       StartHour=9;
extern int       EndHour=18;

[........]

  if (Digits == 3 || Digits == 5)
{
PipValue=10;
} 
else
{
PipValue=1;
}
[...]
double LotsOptimized()
[...]
 bool CheckMoneyForTrade(string symb, double lots,int type)
[...]
      if (MaximumRisk > 1.8 && MaximumRisk < 0.1) 
      { 
      Print("RIDUCI LA LEVERAGE! In attesa di tua modifica, i trade verranno eseguiti a 0.01 lotti"); 
      lot =0.01;
      } 
      
      double MinLot = 0.01;
      double MaxLot = 10.0;
      if(lot<MinLot)     { 
      Print("EA noticed a too low lotsize; this will be corrected"); 
     lot=MinLot;
      }    
      if(lot>MaxLot){
          Print("EA noticed a too high lotsize; this will be corrected"); 
       lot=MaxLot;
      }
if(Trail == true) BreakEven();
[...]
OrderSend(Symbol(),OP_BUYSTOP,LotsOptimized()*M3,Ask+Distance1,2,Ask+Distance1-Stop_Loss*Point,Ask+Distance1+TakeProfit*Point,"A_BORASO",15021987,TimeCurrent()+Expiration,Yellow);
[...]
void BreakEven()  //breakeven function moves SL on 3 Profit Steps if reached. 0.003 is +30 pips step move , for example.
[...]
 
Use the search function this question is asked twice a day.
 
Marco vd Heijden:
Use the search function this question is asked twice a day.

i have searched on Forum and explainations are not easy to be fit on my problem. So i have shown my personal case. This question is frequent because is very frustrating to make efforts in developing a good EA and then get stopped by mysterious errors that only Automatic Validator can find and user is not able to fix it till the validator only writes "error n."

i have modified parts of the code for 8 hours at least! it's out of mind
 

It very CLEARLY states error 131 invalid Lotsize.

https://www.mql5.com/en/articles/2555#invalid_lot

Also why can't your robot run on NZDUSD ? 

It should be able to run on all instruments, OR you will have to put a filter that makes sure it ONLY runs on EURUSD.

The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks, as a small error in the expert or indicator logic can cause losses on the trading account. That is why we have developed a series of basic checks to ensure the required quality level of the Market products. If any errors are identified by the Market...
 
Marco vd Heijden:

It very CLEARLY states error 131 invalid Lotsize.

https://www.mql5.com/en/articles/2555#invalid_lot

Sorry Marco, why only the validator finds an invalid lot size while the backtester opens every order without any problem?

i got the LotsOptimized() function in my code and that already make checks on minlot,maxlot,lotstep . it is called during every OrderSend.

 
Because the backtester is not the automatic validator.
 
Marco vd Heijden:
Because the backtester is not the automatic validator.
have i to place the CheckVolumeValue function at the bottom of code or on head?
 
Alessandro Boraso:
have i to place the CheckVolumeValue function at the bottom of code or on head?

Don't you already?

Making an EA without lot size checking prior to attempting to place an order/position is rather strange, at the least. If you do not have such function, make one - if for nothing else, for your own safety when you let the EA trade

 
Mladen Rakic:

Don't you already?

Making an EA without lot size checking prior to attempting to place an order/position is rather strange, at the least. If you do not have such function, make one - if for nothing else, for your own safety when you let the EA trade

so if you consider my OrderSend commands are inside void OnTick()   , where should i place the CheckVolumeValue function to let it work?
 
Alessandro Boraso:
so if you consider my OrderSend commands are inside void OnTick()   , where should i place the CheckVolumeValue function to let it work?

As usual : prior to attempting to place an order

 

Hi, I tried called the CheckVolumeValue function, in main EA before OrderSend: 

double volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);  

string descr;

CheckVolumeValue(volume,descr);

but not working. Can any senior advise? Thanks.

Reason: