Ordersend Error 134 – Err_not_enough_money

If you are getting the Metatrader 4 error: Ordersend Error 134, it means you do not have enough money in your account to place an order with the given lot size. What should you do?

Ordersend error 134 tends to happen a lot when people code expert advisors with a money management style that increases lot sizes such as Martingale. Eventually the lot size gets too big and you do not have enough margin to place the trade. This can also happen over time if your account balance gets too low or if you select too large of a lot size.

The error occurs when you try to place the trade, thus it is an “ordersend error”. To prevent this error you can check your account free margin before attempting to place a trade. To do this you will use the function, AccountFreeMarginCheck():

double AccountFreeMarginCheck(string symbol, int cmd, double volume)

Returns available margin that remains after the specified position has been opened at the current price on the current account. If the free margin is insufficient, an error 134 (ERR_NOT_ENOUGH_MONEY) will be generated.


symbol – Symbol for trading operation.

cmd – Operation type. It can be either OP_BUY or OP_SELL.

volume – Number of lots.

an example would be:

if(AccountFreeMarginCheck(Symbol(),OP_BUY,Lots)<=0){ // there is not enough margin in the account, so do not trade return(); }

Another function you can use to find the remaining margin is:

double AccountFreeMargin( )

This returns free margin value of the current account.

The following example prints out the free margin for your account:

Print(“Free margin is = “,AccountFreeMargin());

How to Have Intellectual Property Rights For Startups

How to Make Home-Made Soup Stock