Error 134 when the account balance has enough funds

 

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

 
And what is the leverage ?
 

1:100

FX pro MT4 Instant demo account

 
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.

 

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

 

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.

 

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 );
 
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
 
whroeder1:

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

there are no open orders.
 

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.

Reason: