If you’re getting the Metatrader four error: Ordersend Error 134, it means you do not need sufficient cash in your account to put an order with the given lot dimension. What do you have to do?
Ordersend error 134 tends to occur rather a lot when individuals code professional advisors with a cash administration type that will increase lot sizes resembling Martingale. Eventually the lot dimension will get too large and also you do not need sufficient margin to put the commerce. This may occur over time in case your account stability will get too low or if you choose too massive of rather a lot dimension.
The error happens if you attempt to place the commerce, thus it’s an “ordersend error”. To stop this error you’ll be able to verify your account free margin earlier than making an attempt to put a commerce. To do that you’ll use the perform, AccountFreeMarginCheck():
double AccountFreeMarginCheck(string image, int cmd, double quantity)
Returns out there margin that continues to be after the desired place has been opened on the present value on the present account. If the free margin is inadequate, an error 134 (ERR_NOT_ENOUGH_MONEY) shall be generated.
Parameters: image – Symbol for buying and selling operation. cmd – Operation kind. It could be both OP_BUY or OP_SELL. quantity – Number of heaps.
an instance can be:if(AccountFreeMarginCheck(Symbol(),OP_BUY,Lots)<=0){ // there's not sufficient margin within the account, so don't commerce return(); }
Another perform you should use to search out the remaining margin is:
double AccountFreeMargin( )
This returns free margin worth of the present account.
The following instance prints out the free margin on your account:
Print(“Free margin is = “,AccountFreeMargin());
Comentários