MQL5 EA Product Validation Errors Daily Feed - page 4

 
Syed Oarasul Islam:

After checking this function on every places where my EA tries to submit trades I realize the "Not Enough Money" error was not there anymore but then it started to show new error which is Log File Size Exceeded

one message about the lack of money is enough

 
Denis Nikolaev:

one message about the lack of money is enough

For the testing purpose I decided to see what happen if I try to fix the lot size to minimum lot instead of printing. So I tried this:

//+------------------------------------------------------------------+
//| Check free margin                    |
//+------------------------------------------------------------------+
double lot;
bool CheckMoneyForTrade(string symb,double lots,ENUM_ORDER_TYPE type)
  {
//--- Getting the opening price

   double price=Ask;
   if(type==ORDER_TYPE_SELL)
      price=Bid;
      double minvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
//--- values of the required and free margin
   double required_margin=RoboAccountInfo.MarginCheck(symb,type,lots,price);
   double free_margin=RoboAccountInfo.FreeMargin();
   //--- call of the checking function

   //--- if there are insufficient funds to perform the operation
   if(required_margin>free_margin)
     {
      //--- report the error and return false
      //Print("Not enough money for ",EnumToString(type)," ",lots," ",symb," Error code=",GetLastError());
      
   
      lot=minvol;
      //return(false);
     }
//--- checking successful
   return(true);
  }
//+------------------------------------------------------------------+
//| Optimize lot sizes                    |
//+------------------------------------------------------------------+

double lotSize(void){ 
   
   double price=0.0;
   double margin=0.0;
//--- select lot size
   if(!SymbolInfoDouble(_Symbol,SYMBOL_ASK,price))
      return(0.0);
   if(!OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,1.0,price,margin))
      return(0.0);
   if(margin<=0.0)
      return(0.0);
 lot=NormalizeDouble(AccountInfoDouble(ACCOUNT_MARGIN_FREE)*AutoLotRisks/margin,2);   
     
     
//--- normalize and check limits
   double stepvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
   lot=stepvol*NormalizeDouble(lot/stepvol,0);

   double minvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
   if(lot<minvol)
      lot=minvol;

   double maxvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX);
   if(lot>maxvol)
      lot=maxvol;
//--- return trading volume
   return(lot);
} 

Now I got strange errors. The validator is now trying to trade with currency size not lot size. 

Errors count     22
test on EURUSD,H1 (hedging)
log files size exceeded 2051 MB, test terminated
 2016.04.01 01:30:17   current account state: Balance: 10000.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 10000.00, Margin: 0.00, FreeMargin: 10000.00
 2016.04.01 01:30:17   calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 10000.00, Margin: 2275420.00, FreeMargin: -2265420.00
 2016.04.01 01:30:17   not enough money [instant buy 2.0K EURUSD at 1.13771 sl: 1.10704 tp: 1.16838]
 2016.04.01 01:30:17   failed instant buy 2.0K EURUSD at 1.13771 sl: 1.10704 tp: 1.16838 [No money]
 2016.04.01 01:30:18   current account state: Balance: 10000.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 10000.00, Margin: 0.00, FreeMargin: 10000.00
 2016.04.01 01:30:18   calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 10000.00, Margin: 2275460.00, FreeMargin: -2265460.00
 2016.04.01 01:30:18   not enough money [instant buy 2.0K EURUSD at 1.13773 sl: 1.10706 tp: 1.16840]
 2016.04.01 01:30:18   failed instant buy 2.0K EURUSD at 1.13773 sl: 1.10706 tp: 1.16840 [No money]
 2016.04.01 01:30:20   current account state: Balance: 10000.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 10000.00, Margin: 0.00, FreeMargin: 10000.00
 2016.04.01 01:30:20   calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 10000.00, Margin: 2275440.00, FreeMargin: -2265440.00
 2016.04.01 01:30:20   not enough money [instant buy 2.0K EURUSD at 1.13772 sl: 1.10705 tp: 1.16839]
 2016.04.01 01:30:20   failed instant buy 2.0K EURUSD at 1.13772 sl: 1.10705 tp: 1.16839 [No money]
 2016.04.01 01:30:22   current account state: Balance: 10000.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 10000.00, Margin: 0.00, FreeMargin: 10000.00
 2016.04.01 01:30:22   calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 10000.00, Margin: 2275460.00, FreeMargin: -2265460.00
 2016.04.01 01:30:22   not enough money [instant buy 2.0K EURUSD at 1.13773 sl: 1.10706 tp: 1.16840]
 2016.04.01 01:30:22   failed instant buy 2.0K EURUSD at 1.13773 sl: 1.10706 tp: 1.16840 [No money]
 2016.04.01 01:30:23   current account state: Balance: 10000.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 10000.00, Margin: 0.00, FreeMargin: 10000.00
 2016.04.01 01:30:23   calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 10000.00, Margin: 2275440.00, FreeMargin: -2265440.00
 2016.04.01 01:30:23   not enough money [instant buy 2.0K EURUSD at 1.13772 sl: 1.10705 tp: 1.16839]
 2016.04.01 01:30:23   failed instant buy 2.0K EURUSD at 1.13772 sl: 1.10705 tp: 1.16839 [No money]
strategy tester report not found

I am loosing my mind with this Automatic Validator.

 
   //--- if there are insufficient funds to perform the operation
   if(required_margin>free_margin)
     {
      //--- report the error and return false
      //Print("Not enough money for ",EnumToString(type)," ",lots," ",symb," Error code=",GetLastError());
      
   
      lot=minvol;
      //return(false);
     }

The print function is commented out.

It will never pass if you do not write the error to the log.

If you can't get it done you can also find help here: https://www.mql5.com/en/job
Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • www.mql5.com
I would like you to design a EA based on RSI, whenever it gets sell alert, sale;  and buy alert , buy. the same as what you did for  me before, TP and stop loss , trailing stop etc. I will attach the indicator once you accept the job. I do need this EA soon if its possible Thanks We are a licensed fsp (QuickTrade fsp:45262).  We have...
 
Syed Oarasul Islam:

For the testing purpose I decided to see what happen if I try to fix the lot size to minimum lot instead of printing. So I tried this:

Now I got strange errors. The validator is now trying to trade with currency size not lot size. 

I am loosing my mind with this Automatic Validator.

bool signal=false;
void OnTick()
  {
   ENUM_POSITION_TYPE PosType=POSITION_TYPE_SELL;
   MqlTradeRequest request;
   MqlTradeResult result;
   MqlTradeCheckResult check;
   ZeroMemory(request);
   ZeroMemory(result);
   ZeroMemory(check);
   long digit;
   double point,Bid;
   SymbolInfoDouble(_Symbol,SYMBOL_BID,Bid);
   request.type   = ORDER_TYPE_SELL;
   request.price  = Bid;
   request.action = TRADE_ACTION_DEAL;
   request.symbol = _Symbol;
   request.volume = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
   request.sl=0;
   request.tp=0;
   request.deviation=10;
   request.magic=55555;
   request.comment=NULL;
   request.type_filling=0;

   if(PositionsTotal()==0
   &&CheckMoneyForTrade(_Symbol,SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN),ORDER_TYPE_SELL)==true
   &&signal==false//one message a day about the lack of money
   ){
      OrderSend(request,result);
   }else{
      return;
   }
   if(DayMQL4()!=tekday){
      tekday=DayMQL4();
      signal=false;//one message a day about the lack of money
   }
  }

  bool CheckMoneyForTrade(string symb,double lots,ENUM_ORDER_TYPE type)
  {
   MqlTick mqltick;
   SymbolInfoTick(symb,mqltick);
   double price=mqltick.ask;
   if(type==ORDER_TYPE_SELL)
      price=mqltick.bid;
   double margin,free_margin=AccountInfoDouble(ACCOUNT_MARGIN_FREE);
   if(!OrderCalcMargin(type,symb,lots,price,margin))
     {
      if(signal==false){//one message a day about the lack of money
      Print("Error in ",__FUNCTION__," code=",GetLastError());
      Alert("Error in ",__FUNCTION__," code=",GetLastError());
      signal=true;
      }
      return(false);
     }
   if(margin>free_margin)
     {
      if(signal==false){//one message a day about the lack of money
         Print("Not enough money for ",EnumToString(type)," ",lots," ",symb," Error code=",GetLastError());
         Alert("Not enough money for ",EnumToString(type)," ",lots," ",symb," Error code=",GetLastError());
         signal=true;
      }
      return(false);
     }
   return(true);
  }
int DayMQL4()
 {
 MqlDateTime tm;
 TimeCurrent(tm);
 return(tm.day);
 }

try to do in your code as above

 
Marco vd Heijden:

The print function is commented out.

It will never pass if you do not write the error to the log.

If you can't get it done you can also find help here: https://www.mql5.com/en/job

You are actually not helping at all. I know I have option to hire. 

 
Denis Nikolaev:

try to do in your code as above

Okey I am on it . Will get back soon with the result. Thanks . 

 
Denis Nikolaev:

try to do in your code as above

What is tekday?

 
Syed Oarasul Islam:

What is tekday?

int tekday=0 global variable equal to the current day

the point is to notify the user about the lack of money only once a day
 
Maybe you can monitor AccountBalance() to see whether a deposit has been made, and then try again.
 

Don't waste your time. There is obviously something wrong with current Auto-validation process.

I tried with fixed minimum volume, and still it tries to open 2.000 lots !

   double lot=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);//NormalizeDouble(AccountInfoDouble(ACCOUNT_MARGIN_FREE)*MaximumRisk/margin,2);
//--- return trading volume
   return(lot);

So either they put the minimum volume on their server to 2,000 lots which is insane, or they force a 2,000 lots even when you asked for 0.01 which is not less insane.

If you try with hardcoded 0.01, it becomes :

There is never a 0.00 in the source code. So no idea what they are doing.