EA Error code 131

 
Hello,

I got an EA from a friend, but I do have problems with the Error 131 which I learnt means, that the calculated trade volume is not allowed by the broker. Is there somebody who could fix the .mq4 code an add in a trade volume check before the OrderSend function is executed.

I am not able to get it fixed by myself.


If you can help me out, let me know and I will send you the .mq4 code.

Thanks in advance.



Regards

Michael
 
Michael Breu:
Hello,

I got an EA from a friend, but I do have problems with the Error 131 which I learnt means, that the calculated trade volume is not allowed by the broker. Is there somebody who could fix the .mq4 code an add in a trade volume check before the OrderSend function is executed.

I am not able to get it fixed by myself.


If you can help me out, let me know and I will send you the .mq4 code.

Thanks in advance.



Regards

Michael
Just post up the block of code dealing with the ordersend - most people won't want to wade through all the other code anyway if it is just a 131 error.

You can use the SRC button when attaching code.
 
if (g_lots_508 > 100.0) g_lots_508 = 100;
         OrderSend(Symbol(), OP_SELL, g_lots_508, NormalizeDouble(g_bid_492,Digits), g_slippage_464, g_price_468, g_price_476, g_comment_336, MagicNumber, 0, g_color_436);
         return;
      }
 
Michael Breu:
if (g_lots_508 > 100.0) g_lots_508 = 100;
         OrderSend(Symbol(), OP_SELL, g_lots_508, NormalizeDouble(g_bid_492,Digits), g_slippage_464, g_price_468, g_price_476, g_comment_336, MagicNumber, 0, g_color_436);
         return;
      }
That looks awfully like decompiled code which is not allowed here. Besides, always lookup the error code's meaning - in this case Error 131 is "Invalid Trade Volume".

Always check your volume against the Broker's Maximum, Minimum and Step Size (MODE_MAXLOT, MODE_MINLOT, MODE_LOTSTEP) before blindly applying it to an order.
Trade Server Return Codes - Codes of Errors and Warnings - Standard Constants, Enumerations and Structures - MQL4 Reference
Trade Server Return Codes - Codes of Errors and Warnings - Standard Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
Trade Server Return Codes - Codes of Errors and Warnings - Standard Constants, Enumerations and Structures - MQL4 Reference
 
g_lots_508, NormalizeDouble(g_bid_492,Digits), g_slippage_464, g_price_468, g_price_476, g_comment_336, MagicNumber, 0, g_color_436

Ask the owner of the source code to give it to you or have him fix it for you.

Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property. Either way we will not be an accomplice after the fact to theft. See also https://www.mql5.com/en/forum/134317#comment_3411571

If you post decompiled code again, you will likely be banned.

Don't tell us you found it on the 'net: if someone stole your bank details and uploaded them on to the internet, is it OK for everyone to use them because "someone uploaded it, I don't know why I can't use that"?