Hard time to upload My EA in MQL5 market. - page 2

 

Forum on trading, automated trading systems and testing trading strategies

Tortured by the error there are no trading operations

Aleksandr Kononov, 11/20/20/07 7:46 PM

Here's how I went through the validation. An Expert Advisor without stops and order modifications, but on all timeframes .

The validator issued error 131 (wrong lot) and there were no trade operations. This is my first advisor, so there were probably all the mistakes that were possible.

First, I added all the comments in English to the trading function checks. that is, if the Expert Advisor does not trade, it should issue an error in Print ().

I also added a free margin check and removed all ExpertRemove (), but that did not help, the errors were the same.

 void buy()
  {
   if (AccountFreeMarginCheck( Symbol (),OP_BUY,Lots)> 0 )
     {
       if ( OrderSend ( _Symbol ,OP_BUY,Lots,Ask,Slip,SLb, 0 ,comment,Magic, 0 ,Green)< 1 )
         Print ( " Buy ​​order error !" + IntegerToString ( _Period , 0 ) + " Error code = " + IntegerToString ( GetLastError (), 0 ));
     }
   else
       Print ( "Not enough money!" + " Error code = " + IntegerToString ( GetLastError (), 0 ));
       /// ExpertRemove();
   return ;   
  }

Then I made several changes at once and it is not clear which of this helped.

Clearing errors at the beginning and at the end of the advisor's work, checking the availability of quotes on all TFs

 int OnInit ()
  {
     ResetLastError ();   

       for ( int cycle= 1 ; cycle<= 5 ; cycle++)
     {
       switch (cycle)
        {
         case 1 :
            TF = PERIOD_D1 ;
             break ;
         case 2 :
            TF = PERIOD_H4 ;
             break ;
         case 3 :
            TF = PERIOD_H1 ;
             break ;
         case 4 :
            TF = PERIOD_M15 ;
             break ;
         case 5 :
            TF = PERIOD_M5 ;
             break ;
        }
   if ( iTime ( _Symbol ,TF,Limit)< 1 )
     Print ( "Missing quotes! " + IntegerToString (TF, 0 ) + " Timeframe" + " Error = " + IntegerToString ( GetLastError (), 0 ));            
     }      
   return ( INIT_SUCCEEDED );
  }
//****************************
void OnDeinit ( const int reason)
  {  
   Alert ( "Error = " + IntegerToString ( GetLastError (), 0 ));
   ResetLastError ();
  }

and changed the lot calculation for all cases if the step is (0.1), (0.01) and even (0.001)

 double lotstep = MarketInfo( Symbol (),MODE_LOTSTEP);

   Lots = NormalizeDouble (AccountEquity()/ 10000 *Lot_for_10K, 3 );
   if (lotstep> 0.001 )
   Lots = ( MathRound (Lots/lotstep))*lotstep;    
   Lots = MathMax (Lots,MarketInfo( Symbol (),MODE_MINLOT));
   Lots = MathMin (Lots,MarketInfo( Symbol (),MODE_MAXLOT));

in the end, we can say that it quickly turned out to fix everything, only 2 days and about 10 attempts


 
Duplicate code will no-go and shouldn't be on the list of things you don't want in the codebase. It's the maintainability of your code that suffers the hardest from duplicate code, and sacrificing maintainability is a bad thing to do. Since most time is spent, by far, on maintenance you should use a (fresh/ unique) new code, that may solve the problem, anyway I don't know much about this it's just an opinion
 

Forum on trading, automated trading systems and testing trading strategies

Tortured by the error there are no trading operations

Nauris Zukas , 2021.11.22 18:30

Still, I found a problem, by default in the input parameters there is a limit on the maximum lot of positions.

 input double MaxLots= 0.1 ;
...
lots = MathMin (lots, MaxLots );

This did not skip opening positions if SYMBOL_VOLUME_MIN in the validator is 0.20. It is impossible for the validator to set by default such a small limit on the maximum lot of positions.


 
Sergey Golubev # :

thanks master, i will try again

 
Sergey Golubev # :

sete

Sergey Golubev # :

after I called Getlasseror Ondeinit, an Allert error 4200 appeared when EA was uninstalled....???

 

unsolved

 

I tried uploading my EA for sale, but I'm getting an error message saying "please recompile your product with new compiler".

Please what do I do?

 

Some more codes (something more ti check in the code to be validated):

Forum on trading, automated trading systems and testing trading strategies

I create a theme for the Developers to see!

Valeriy Yastremskiy , 09/2007 07:34 PM

I already wrote that in the new requirements - it is mandatory to check for the sufficiency of funds, and if they are insufficient so the work of the EA should be stopped. If the work of EA does not stop so there is the validator error (no trade operations ).

 

More -

---------------- 

This post where I collected some decisions.

and the following threads:

 

MQL5 need to modify the way it tests the products before they get uploaded, I can't believe there is no change from 10 years till now. I have much EAs and indicators that i made and couldn't upload them just because of this problem.