Download MetaTrader 5

ERR_INVALID_TRADE_VOLUME 131 Invalid trade volume. error when trying to close order

To add comments, please log in or register
Forex Trader
114293
Forex Trader  
what dos that mean and how can fix it??????

thanks
Forex Trader
114293
Forex Trader  
what dos that mean and how can fix it??????

thanks

this is the log
17:51:04 dayTime started for testing
17:51:04 2005.08.12 03:00  dayTime EURUSD,H1: open #1 buy 0.10 EURUSD at 1.2459 sl: 1.2439 tp: 1.2484 ok
17:51:04 2005.08.12 10:00  dayTime EURUSD,H1: 131Close Long 1 Error
17:51:04 2005.08.12 10:49  Tester: take profit #1 at 1.2484 (1.2484 / 1.2487)
17:51:04 2005.08.12 14:00  dayTime EURUSD,H1: open #2 sell 0.10 EURUSD at 1.2457 sl: 1.2477 tp: 1.2435 ok
17:51:04 2005.08.12 14:44  Tester: take profit #2 at 1.2435 (1.2432 / 1.2435)
17:51:04 2005.08.12 18:00  dayTime EURUSD,H1: open #3 buy 0.10 EURUSD at 1.2424 sl: 1.2404 tp: 1.2449 ok
17:51:04 2005.08.12 20:00  dayTime EURUSD,H1: 131Close Long 3 Error
17:51:04 2005.08.12 22:59  Tester: order #3 is closed


Forex Trader
114293
Forex Trader  
I think, you set wrong Lots parameter in
bool OrderClose( int ticket, double lots, double price, int slippage, color Color=CLR_NONE)
It should be equal to position size or less.

Rafael
Forex Trader
114293
Forex Trader  
expose please source code for orders close. then your question can be answered
Forex Trader
114293
Forex Trader  
I think, you set wrong Lots parameter in
bool OrderClose( int ticket, double lots, double price, int slippage, color Color=CLR_NONE)
It should be equal to position size or less.

Rafael

thanks man it was the lots size , coz i copy the line from other expert
Ali Raza
510
Ali Raza  
I got same error ERR_INVALID_TRADE_VOLUME: it is not Order Close Error it is OrderSend Error . because there is invalid LotVolume for ordersend function. that's why.
Mohammad Soubra
30869
Mohammad Soubra  
Where is the code
You should share it with us
Ali Raza
510
Ali Raza  
I used many codes to solve this issue but not solve yet. i have no problem with mt4 plateform and i did not see this error but on mql5 i got this error .when i solve this then i share the code here. but if any other expert know how to solve this error then please must share with us. Thanks
honest_knave
Moderator
2325
honest_knave  

Error 131 means the lot size is incorrect. Each broker sets their own parameters.

  • There is a minimum lot size (SYMBOL_VOLUME_MIN) e.g. 0.1
  • If you try to trade 0.01 your lot size is invalid
  • There is a maximum lot size (SYMBOL_VOLUME_MAX) e.g. 100
  • If you try to trade 150 your lot size is invalid
  • There is a lot step (SYMBOL_VOLUME_STEP) which your lot size must be an increment of e.g. 0.1
  • If you try to trade 0.15 your lot size is invalid. 

So, before placing any trade you must check these values using SymbolInfoDouble() and adjust your lot size accordingly.

To add comments, please log in or register