Download MetaTrader 5

Huge tester bug? Error 131

To add comments, please log in or register
MQL5 Reference is available in 8 languages. Learn MQL5 in the language that suits you best!
Forex Trader
114257
Forex Trader 2006.03.13 12:41 
Hi,
on numerous occassions and in different situations, I keep getting Error 131 - Invalid trade volume. Backtesting is working just fine and then at some point in time instead of opening new order the OrderSend keeps failing and giving this error. Metatrader build is 191.
Here are the outputs from the relevant functions and values of the trade volume requested:
Volume (lots to open): 127.1
Total open lots: 119.6
AccountBalance 1357252.5272
AccountEquity 1271049.049
AccountFreeMargin 1149674.7672
AccountMargin 207577.76
AccountLeverage 100

So, there is enough free margin, everything seems (to me) just fine. Is there something I'm missing or is this a real huge bug?
It almost completely cripples backtesting capabilities for my expert.

In hope that there is an explanation/solution...
Forex Trader
114257
Forex Trader 2006.03.16 19:31  
Will someone from Metaquotes please comment on this?
Forex Trader
114257
Forex Trader 2006.08.24 09:45  
I'm having the same problem but in build 195. Everything was working fine until I changed the dates of the backtesting window. After that I started getting error 131 after my expert tried to change the lot size (Maybe volume gets set to a constant number???). I tried changing the dates back to the original settings, but I still get the error. During this whole process I changed nothing but the dates in the backtester. I did not change my expert at all nor did I recompile anything. I changed no other settings besides the dates. Hope this helps.

Loopy
Forex Trader
114257
Forex Trader 2006.08.25 00:06  
See sample in the article https://championship.mql5.com/2012/en/2006 after "//--- check min, max and step" line
Forex Trader
114257
Forex Trader 2006.09.07 12:50  
Thanks for the link. I understand why I'm getting the error now. My lots are sized with a two digit precision, which doesn't fit into the parameters set on that page. My next question though is how is the lot precision set particularly in respect to the backtester? Lot sizes with a two digit precision were ok, but now they're not. Why? How is this number set? Lot size precision is different for different brokers isn't it? I know interbankfx offers microlot sizes and the lots I trade there are always set at a two digit precision and I never have problems. Shouldn't we be able to play with this number in the backtester? Is there a way to change it now? Thanks for your help so far!

Jack
Forex Trader
114257
Forex Trader 2006.09.27 12:32  
See sample in the article https://championship.mql5.com/2012/en/2006 after "//--- check min, max and step" line


Hi Slawa, it's been a while since I posted the question.
If you take a look at my first post, you will see that the EA is trying to open 127.1 lots, therefore it is a single digit precision volume, which should work just fine.

Is there a max volume limit in backtesting (not for the championship, but in general)?
Forex Trader
114257
Forex Trader 2006.09.27 12:57  
You can obtain maximal amount of lots using MarketInfo(Symbol(),MODE_MAXLOT) and analyze it
Forex Trader
114257
Forex Trader 2006.09.30 21:09  
You can obtain maximal amount of lots using MarketInfo(Symbol(),MODE_MAXLOT) and analyze it


Thanks for the answer and sorry for the "huge bug" assertion in the topic.
I wasn't aware of this limitation and of the MAXLOT value so it seemed to me like a silly (but important) bug.

Is there a way to raise the MAXLOT value?
Forex Trader
114257
Forex Trader 2006.09.30 23:07  
Is there a way to raise the MAXLOT value?

Of course. You can change integer offsets 148 bytes from begin of FXT-header. For your reference see "MQL4: FXTHeader"
Forex Trader
114257
Forex Trader 2006.10.02 13:32  
Is there a way to raise the MAXLOT value?

Of course. You can change integer offsets 148 bytes from begin of FXT-header. For your reference see "MQL4: FXTHeader"


Great, thanks
To add comments, please log in or register