Download MetaTrader 5

Build 625, OrderSend slippage is being ignored!

To add comments, please log in or register
Keith Watford
Moderator
10570
Keith Watford  

My OrderSends are being rejected due to invalid price in 625.

No matter what the slippage value included in the order, it will only be executed if the OrderSend price and the Bid/Ask is EXACTLY the same.

This is the code that places the order

               RefreshRates();
                  ticket=OrderSend(Symbol(),OP_BUY,lotsize,new_order_entry,Slippage,new_order_entry-stoploss,
                         new_order_entry+takeprofit,"reverse "+(string)LastTicket,MagicNumber,0,clrNONE);
                  if(ticket==-1)
                     {
                     Print("Slippage=",Slippage);
                     Print("Error opening Buy @ ",new_order_entry,"-Current Ask is ",Ask,". ",ErrorDescription(GetLastError()));
                     }

I get lines and lines of error reporting, I just show a few here

17:58:58 RepeatOrders GBPUSD,M1: Slippage=30
17:58:58 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66467. invalid price
17:58:59 RepeatOrders GBPUSD,M1: Slippage=30
17:58:59 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66466. invalid price
17:59:08 RepeatOrders GBPUSD,M1: Slippage=30
17:59:08 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66467. invalid price
17:59:08 RepeatOrders GBPUSD,M1: Slippage=30
17:59:08 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66466. invalid price
17:59:08 RepeatOrders GBPUSD,M1: Slippage=30
17:59:08 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66463. invalid price
17:59:08 RepeatOrders GBPUSD,M1: Slippage=30
17:59:08 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66462. invalid price
17:59:09 RepeatOrders GBPUSD,M1: Slippage=30
17:59:09 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66459. invalid price
17:59:10 RepeatOrders GBPUSD,M1: Slippage=30
17:59:10 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66454. invalid price
17:59:10 RepeatOrders GBPUSD,M1: Slippage=30
17:59:10 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66451. invalid price
17:59:10 RepeatOrders GBPUSD,M1: Slippage=30
17:59:10 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.6645. invalid price
17:59:12 RepeatOrders GBPUSD,M1: Slippage=30
17:59:12 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66451. invalid price
17:59:13 RepeatOrders GBPUSD,M1: Slippage=30
17:59:13 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.6645. invalid price
17:59:16 RepeatOrders GBPUSD,M1: Slippage=30
17:59:16 RepeatOrders GBPUSD,M1: Error opening Buy @ 1.66452-Current Ask is 1.66451. invalid price
17:59:17 RepeatOrders GBPUSD,M1: open #111199928 buy 0.10 GBPUSD at 1.66452 sl: 1.66152 tp: 1.66752 ok

I cannot understand why these orders are being rejected when they are well withing the margin given by the slippage.

As you can see, the order was only executed when the order price and Ask were exactly the same.

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
Have you tried to use Bid?
Keith Watford
Moderator
10570
Keith Watford  
deysmacro:
Have you tried to use Bid?

Why would I use Bid for a Buy position?
Alain Verleyen
Moderator
32524
Alain Verleyen  
GumRai:

My OrderSends are being rejected due to invalid price in 625.

No matter what the slippage value included in the order, it will only be executed if the OrderSend price and the Bid/Ask is EXACTLY the same.

This is the code that places the order

I get lines and lines of error reporting, I just show a few here

I cannot understand why these orders are being rejected when they are well withing the margin given by the slippage.

As you can see, the order was only executed when the order price and Ask were exactly the same.

The new_order_entry must be the Ask price. What is the value you are affecting to this variable ?
onewithzachy
2271
onewithzachy  

Try new_order_entry after RefreshRates() and slippage bigger than 3 pips:

RefreshRates():
new_order_entry = Ask; //--- or MarketInfo(Symbol, MODE_ASK)


Keith Watford
Moderator
10570
Keith Watford  
angevoyageur:
The new_order_entry must be the Ask price. What is the value you are affecting to this variable ?


Unless there have been some changes that I have not seen in the documentation, then what you say is not true.

As long as the Ask price is within the range new_order_entry + - slippage, it should be executed.

Keith Watford
Moderator
10570
Keith Watford  
onewithzachy:

Try new_order_entry after RefreshRates() and slippage bigger than 3 pips:

RefreshRates():
new_order_entry = Ask; //--- or MarketInfo(Symbol, MODE_ASK)

Sorry, but that is not what I wanted, if price suddenly moved a lot in between ticks, I will not blindly accept whatever the Ask happens to be.
Alain Verleyen
Moderator
32524
Alain Verleyen  
GumRai:


Unless there have been some changes that I have not seen in the documentation, then what you say is not true.

As long as the Ask price is within the range new_order_entry + - slippage, it should be executed.

There is no change, it has always been so. Slippage doesn't mean that you can set an other price than bid/ask. See documentation of OrderSend.

At opening of a market order (OP_SELL or OP_BUY), only the latest prices of Bid (for selling) or Ask (for buying) can be used as open price.

Slippage means that if the price (bid/ask) is no more available when your order is executed, then you accept a slippage of x points.

Simon Gniadkowski
Moderator
18024
Simon Gniadkowski  
angevoyageur:

There is no change, it has always been so. Slippage doesn't mean that you can set an other price than bid/ask. See documentation of OrderSend.

Slippage means that if the price (bid/ask) is no more available when your order is executed, then you accept a slippage of x points.

Some Brokers will accept the Order regardless of the price you try and open at . . . Bid, Ask 10,000 0.2 . . . anything. Yes I know the Documentation says otherwise and yes I contacted the Service Desk about it, 18th March last year, no reply, and I contacted Rosh . . . no help


https://www.mql5.com/en/forum/143892/page2

Alain Verleyen
Moderator
32524
Alain Verleyen  
RaptorUK:

Some Brokers will accept the Order regardless of the price you try and open at . . . Bid, Ask 10,000 0.2 . . . anything. Yes I know the Documentation says otherwise and yes I contacted the Service Desk about it, 18th March last year, no reply, and I contacted Rosh . . . no help


https://www.mql5.com/en/forum/143892/page2

I am aware of this case but it's not related to this topic, as the issue of the OP is that the order is not accepted.
qjol
3243
qjol  

there are a lot of brokers calling themselves ECN and ignoring slippage

try to change a server

12
To add comments, please log in or register