Expert not approved in automatic validation process - page 2

 
Lorentzos Roussos:
Try adding this on ontick .

I had an EA made with this code only and when uploading it to the market place it returns the attached error. Any idea how to fix this?

Thanks.

Files:
Error.JPG  15 kb
 
Try this one : 

Quick Note : Use this if your EA trades but is MultiPair/MultiTimeframe ,or requires external data feeds , and cant be tested with the default methods .
In other cases just choose one of the non trading product categories while uploading (Utilities etc) 

//+------------------------------------------------------------------+
//|                                                  MarketFrame.mq4 |
//|                          Copyright 2019 , Thomas Hoegh Reisenhus |
//|                            https://www.mql5.com/en/users/baltobi |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019 , Thomas Hoegh Reisenhus"
#property link      "https://www.mql5.com/en/users/baltobi"
#property version   "1.00"
#property strict
//--- input parameters
input bool     Simulator=true;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   //EventSetTimer(60);
      
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   //EventKillTimer();
      
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
int sim_tr=0;
int sim_lm=19000;
void OnTick()
  {
  
//---
int intester=MQLInfoInteger(MQL_TESTER);
//Simulation starts here 
if(intester==1&&Simulator==true) 
  {
  sim_tr++;
  if(sim_tr==sim_lm)
   {
   int mot=OrdersTotal();
   int cot=(int)AccountInfoInteger(ACCOUNT_LIMIT_ORDERS);
   
   double lot=MarketInfo(Symbol(),MODE_MINLOT);
   double pip=Point();
   int ilim=(int)SymbolInfoInteger(Symbol(),SYMBOL_TRADE_STOPS_LEVEL);
    double lim=ilim;
    lim=lim*2;
   double sl=600;
   if(sl<lim) sl=lim;
   double tp=5000;
   if(tp<lim) tp=lim*2;
   //check if margin is available
   //margin for one lot
   double mfol=MarketInfo(Symbol(),MODE_MARGINREQUIRED);
   //margin for min lot
   mfol=mfol*lot*2;
   if(mfol<AccountFreeMargin())
   {
   if(mot<cot)
     {
     bool check=OrderSend(Symbol(),OP_BUY,lot,Ask,10,Ask-sl*Point(),Ask+tp*Point(),NULL,0,0,clrRed);
     }
   }
   sim_tr=0;
   }
  }
//Simulation ends here 
}
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---
   
  }
//+------------------------------------------------------------------+
 
Lorentzos Roussos:
Try this one : 


It worked, thanks! 

Reason: