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.
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 ));
Print ( "Not enough money!" + " Error code = " + IntegerToString ( GetLastError (), 0 ));
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 ()
for ( int cycle= 1 ; cycle<= 5 ; cycle++)
case 1 :
TF = PERIOD_D1 ;
case 2 :
TF = PERIOD_H4 ;
case 3 :
TF = PERIOD_H1 ;
case 4 :
TF = PERIOD_M15 ;
case 5 :
TF = PERIOD_M5 ;
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 ));
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
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.
thanks master, i will try again
after I called Getlasseror Ondeinit, an Allert error 4200 appeared when EA was uninstalled....???
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?
Please enable the necessary setting in your browser, otherwise you will not be able to log in.