Download MetaTrader 5

Error 134 when the account balance has enough funds

To add comments, please log in or register
Glaramara LLC
276
Mikayil Mammadov  

Hello folks

I am testing my EA on a MT4 terminal installed on a ubuntu machine.

My robot kicks out Order Place Failed: 134 despite the account balance has sufficient funds.

The lot size is just 0.1 when the account balance is 10k.

I did my research and couldn't find any reference to this case.

Any help is appreciated.

Regards,

M

Alain Verleyen
Moderator
33290
Alain Verleyen  
And what is the leverage ?
Glaramara LLC
276
Mikayil Mammadov  

1:100

FX pro MT4 Instant demo account

Alain Verleyen
Moderator
33290
Alain Verleyen  
Mikayil Mammadov:

1:100

FX pro MT4 Instant demo account

Print your values and check all once again. Or show your code.

You could also try on Windows if you think the problem comes from Ubuntu.

Glaramara LLC
276
Mikayil Mammadov  

I placed a market order with a lot size 0.1 manually and it went through.

Glaramara LLC
276
Mikayil Mammadov  

There is nothing wrong in the code. It worked well. It stopped working after I switched from fixed spreads account to float spreads. I will double check through printing.

Glaramara LLC
276
Mikayil Mammadov  

I suspect it could be a slippage value


switch(_OP)
   {
      case OP_BUY  : _Ticket = OrderSend(symbol,OP_BUY,_Lots,AskPrice,_SlippageInPips,SLprice,TPprice,_Comment,_MagicNumber,0,clrAqua);
                     break;
                     
      case OP_SELL : _Ticket = OrderSend(symbol,OP_SELL, _Lots,BidPrice,_SlippageInPips,SLprice,TPprice,_Comment,_MagicNumber,0,clrTomato);
                     break;
      default      : Alert("Wrong Market Order type");
   }              
   if(_Ticket == -1)
   {
         int _Error = GetLastError() ;
         Print("Order Place Failed:",_Error," OP_",_OP );
whroeder1
15902
whroeder1  
Mikayil Mammadov: My robot kicks out Order Place Failed: 134 OP_1 despite the account balance has sufficient funds.

Account balance is irrelevant, it is the remaining free margin after all open orders and the new one.

Risk depends on your initial stop loss and lot size.
  • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
  • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
  • Do NOT use TickValue by itself - DeltaPerLot
  • You must normalize lots properly and check against min and max.
  • You must also check FreeMargin to avoid stop out
Glaramara LLC
276
Mikayil Mammadov  
whroeder1:

Account balance is irrelevant, it is the remaining free margin after all open orders and the new one.

there are no open orders.
Glaramara LLC
276
Mikayil Mammadov  

Update.

The issue was in the slippage value. It was just 5 points. I changed it to 100 points and it is working now correctly.

To add comments, please log in or register