Problem with EA validation on the Market - page 7

 
Sergey Gritsay:

Hello all! Who was able to bypass the check with a balance of $ 1, I have in my code is check if not enough money trade operations do not perform. Accordingly I get the following validation log

test on EURUSD,H1
there are no trading operations
test on NZDUSD,H1
there are no trading operations
test on GBPUSDcheck,M30
there are no trading operations
test on XAUUSDcheck,Daily
there are no trading operations


What if I check my balance during initialization and check the minimum required margin for the minimum lot, and if I don't have enough money, I should just not start my Expert Advisor?
 
Alexey Kozitsyn:
What if at the initialisation stage you check the balance, check the minimum required margin for the min. lot and, if not enough, just don't start the Expert Advisor?
tried it does not help
 
Sergey Gritsay:
tried it does not help

Hm. Interesting, given that, in fact, the output at the initialisation stage means that the input parameters, which in this case could include the balance...

Does the Expert Advisor give out an error in this case? Or it silently "departs"?

 
Alexey Kozitsyn:

Hm. Interesting, given that, in fact, the output at the initialisation stage means that the input parameters, which in this case could include the balance...

Does the Expert Advisor give out an error in this case? Or it silently "departs"?

I am adding this code

   if(IsTesting())
     {
     if(AccountFreeMarginCheck(_Symbol,OP_BUY,SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN))<=0.0)
     {
      return(INIT_PARAMETERS_INCORRECT);
     }

i get this response

test on EURUSD,H1
there are no trading operations
test on NZDUSD,H1
2016.02.01 00:00  exp_martin_new NZDUSD,H1: initialization failed (32767)
there are no trading operations


validation failed again.

 
Sergey Gritsay:

I add this code

MT5? Apparently MT4. And why only check in the tester?
 

In fact, there's an article on the subject. And there's a code:

bool CheckMoneyForTrade(string symb, double lots,int type)
  {
   double free_margin=AccountFreeMarginCheck(symb,type,lots);
   //-- если денег не хватает
   if(free_margin<0)
     {
      string oper=(type==OP_BUY)? "Buy":"Sell";
      Print("Not enough money for ", oper," ",lots, " ", symb, " Error code=",GetLastError());
      return(false);
     }
   //-- проверка прошла успешно
   return(true);
  }

So if anyone doesn't like something, link to this article.

 
Alexey Kozitsyn:
MT5? Apparently MT4. Why only check in the tester?
What do you mean in the tester? When trading I have the check organised in the order opening function
 
Sergey Gritsay:
What do you mean in the tester? When trading, I have the check organised in the order opening function
if(IsTesting())
I'm not quite sure what this condition is for then?
 
Alexey Kozitsyn:

In fact, there's an article on the subject. And there's a code:

bool CheckMoneyForTrade(string symb, double lots,int type)
  {
   double free_margin=AccountFreeMarginCheck(symb,type,lots);
   //-- если денег не хватает
   if(free_margin<0)
     {
      string oper=(type==OP_BUY)? "Buy":"Sell";
      Print("Not enough money for ", oper," ",lots, " ", symb, " Error code=",GetLastError());
      return(false);
     }
   //-- проверка прошла успешно
   return(true);
  }

So if anyone doesn't like something, link to this article.

if you use this function you get a validation errorthere are no trading operations and it is not clear how to bypass this correctly
 
Sergey Gritsay:
if you use this function you get a validation errorthere are no trading operations and it is not clear how to get around it
Ask a question to the marketplace moderator...
Reason: