You should backtest the EA with a larger lot size that exceeds the margin limit,
or the broker lot size limit. Then, of course you will get an error, -- because the validation process performs that stage.
So, now you can set a new function to handle it automatically.
You can use this function to normalize volume:
double NormalizeVolume(const double volume,string symbol=NULL)
if(symbol==NULL || symbol=="") symbol=_Symbol;
You have to check if the returned value isn't zero (it means that your requested volume is less than the minimum allowed volume).
I am using this code for Money Management, it uses NormalizeDouble for round lots and minimum lot size (0.01):
//---------------------------------------------- Money management ---!
So I think MQL5 system doesn't admit less than 0.1 lot, is it true?
I tried this and doesn't give that error anymore.
Now it gives a new error code 134, I tried this:
And now error 131 again..............
"If a check shows that there are insufficient funds to perform a trade
operation, it is necessary to output an error message to the log instead
of calling the OrderSend() function".
Just added that error message and passed the validation. Thanks to all.