Limit order slippage statistics on the exchange - page 5

 

I didn't create an unnecessary thread as the topic of discussion is related to the sub-genre. However, I will draw a red line to make it immediately clear that there is no need to read BEFORE it.

THE DISCUSSION UP TO THIS POINT HAS NOTHING TO DO WITH THE ONE AFTERWARDS.

 
An application was submitted to the SD reproducing a bug - slipping in the tester of a stock limit order

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

fxsaber, 2017.04.07 17:21

Expert Advisor for the tester (Metaquotes-Demo)
#include <MT4Orders.mqh>

// Скольжение лимитника на RTS-6.17
void OnTick()
{
  MqlTick Tick;    
  SymbolInfoTick(_Symbol, Tick);

// 2017.04.06 10:00:00                [time]   [bid]   [ask]  [last] [volume]    [time_msc] [flags]  
// 2017.04.06 10:00:00   2017.04.06 10:00:00  114200  114260  114200        2 1491472800335      56  
  if (Tick.time_msc == 1491472800335)
    OrderSend(_Symbol, OP_BUYLIMIT, 1, 114250, 0, 0, 0);
}

Result

2017.04.07 18:18:45.366 RTS-6.17 : real ticks begin from 2017.04.06 00:00:00
2017.04.07 18:18:45.778 2017.04.06 10:00:00   buy limit 1.00 RTS-6.17 at 114250 (114200 / 114260 / 114200)
2017.04.07 18:18:46.051 2017.04.06 10:00:00   order [#2  buy limit 1.00 RTS-6.17 at 114250] triggered
2017.04.07 18:18:46.051 2017.04.06 10:00:00   deal #2  buy 1.00 RTS-6.17 at 114240 done (based on order #2)
2017.04.07 18:18:46.051 2017.04.06 10:00:00   deal performed [#2  buy 1.00 RTS-6.17 at 114240]
2017.04.07 18:18:46.051 2017.04.06 10:00:00   order performed buy 1.00 at 114240 [#2  buy limit 1.00 RTS-6.17 at 114250]

Limit sliding on stock symbol - BAG!

Below is a conversation
Support Team 2017.04.10 18:04

fxsaber

Limit sliding on a stock symbol is a BAG!

On what basis are these conclusions?

Let's assume the current market is 114300 / 114280.

You set a limit order to buy limit 114250. Someone in the market decided to sell at a guaranteed price and set a sell limit of 114200, as a result he has collected all buy limit orders in the range of the market to 114200.

This is quite a normal situation in the stock market.

Support Team2017.04.11 09:58

fxsaber

  1. It was about the tester.
  2. In this scenario, positive slippage will only be for someone who has set a sell limit worse than the market. And the corresponding buylimits will be executed without slippage.

1. it is clear.

2. What do you mean "only"? For those who trade on the exchange will be disagree, to put it mildly. By the way they have already been dissenting.

Support Team2017.04.11 11:00

fxsaber

I suggest this discussion be taken to the public. As you have some knowledge and experience, I have others. How they correlate with the others can only be seen in public. Do you support me?

In this case, "taking it to the public" won't do anything - there is an objective reality - stock market work, it doesn't depend on appealing to the majority. The decision was not made for nothing, but on the basis of requests from those who actually trade on the exchange.

And as for the sub, there should be no limit slippage in the tester. I think you will agree with me there.
I disagree - see previous replies.

Here's the talk.


The developers claim that if you send a sell limit on an exchange at a price worse than the current price, the best buy limits will be executed with positive slippage. I don't agree with that.

It is not clear on what logic the developers conclude that slipping limit orders (as good as the market) in the TESTER is OK.


Obviously one viewpoint is wrong. I would be grateful if people would comment constructively on this topic.

 

here? https://www.metatrader5.com/ru/terminal/help/general_concept#order_type

В режиме биржевого исполнения цена, указываемая при выставлении лимитных ордеров, не проверяется. Ее можно указать выше текущей цены Ask

(для ордеров на покупку) и ниже цены Sell (для ордеров на продажу). При выставлении ордера с такой ценой он практически сразу срабатывает и превращается в рыночный. Однако в отличие от рыночных ордеров, где трейдер фактически соглашается на сделку по неуказанной текущей рыночной цене, лимитный ордер будет исполнен по цене не худшей, чем указанная.

i.e. in this case the sell limit will not execute worse than114200, and will collect all the buy limit above, but it turns into a market order, why does it affect the buy limit? it is at the best price for the sell limit, which is within the definition of a limit order (at a price no worse than the one specified) at which the sell limit will be executed.

 
Below is the conversation
Support Team 2017.04.10 18:04

fxsaber

Limit sliding on the stock symbol is BAG!

What is the basis for such conclusions?

Suppose the current market is 114300 / 114280.

You place a limit order to buy limit 114250. Someone in the market decided to sell at a guaranteed price and set a sell limit of 114200, as a result he has collected all buy limit orders in the range of the market to 114200.

This is a quite normal situation on the exchange market.

Exchange limit orders cannot slide in the plus or minus direction. There is a logical error in the above example. The fact that the counterparty set a limit order at 114200 (which is worse than the market) does not mean that the buy limit will be executed at 114240 instead of 114250. In this case the counterparty will receive a better price from us at 114250 and will go further down the order book, gaining the required volume and worsening its average price. But our order will be executed without slippage.
 
Vasiliy Sokolov:
The following is a conversation
Exchange limit orders cannot slide in plus or minus. There is a logical error in the above example. Just because the counterparty places a limit sell order at 114200 (which is below the market) does not mean that the buy limit will be able to be filled at 114240 instead of 114250. In this case the counterparty will receive a better price from us at 114250 and will go further down the order book, gaining the required volume and worsening its average price. But our order will be executed without slippage.
I agree with the previous speaker. The only thing I do not agree with is "no slippage".)
 
 
Vasiliy Sokolov:
Below is a conversation
Market Limit orders cannot slide up or down. In this example there is a logical error. The fact that the counterparty put a limit sell order at 114200 (which is worse than the market price) does not mean that the buy limit will be executed at 114240 instead of 114250. In this case the counterparty will receive a better price from us at 114250 and will go further down the order book, gaining the required volume and worsening its average price. But our order will be executed without slippage.

I agree. I jumped the gun on this example.

Consider a case like this:

Here is such an Expert Advisor:

//+------------------------------------------------------------------+
//|                                               MarketBuyLimit.mq5 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#include <Trade\Trade.mqh>

int ExtLastHour=0;
int ExtOverMarket=1000;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   MqlDateTime dt;
   TimeTradeServer(dt);
//---
   if(dt.hour!=ExtLastHour)
     {
      CTrade  trade;
      MqlTick tick;
      double  point=SymbolInfoDouble(Symbol(),SYMBOL_POINT);
      //--- получим тик
      SymbolInfoTick(Symbol(),tick);
      //--- есть позиции?
      if(!PositionsTotal())
        {
         if(!trade.BuyLimit(1.0,tick.ask+ExtOverMarket*point,Symbol()))
           Print("BuyLimit setup failed");
        }
      else
        {
         if(!trade.SellLimit(1.0,tick.bid-ExtOverMarket*point,Symbol()))
           Print("BuyLimit setup failed");
        }
      ExtLastHour=dt.hour;
     }
  }

I.e. we open and close with limit orders 1000 pips better than the market (price above ask for Buy Limit, and price below bid for Sell Limit).

Here is how a deal chart will look like in the case of execution without slippage:

And this is how it will look when executed with a slippage:


Let's try to think how to combine the correct operation of both options.

 

We have made the necessary changes to correctly handle both cases of limit orders in exchange mode - better than market and worse than market.

To be available after the update of MetaQuotes-Demo in the next few days.

 
MQ Alexander:

We have made the necessary changes to correctly handle both cases of limit orders in exchange mode - better than market and worse than market.

It will be available after the MetaQuotes-Demo update in the next few days.

Forum on trading, automated trading systems and testing trading strategies

FORTS. Questions on execution

fxsaber, 2017.02.22 23:32

There are two "types" of limiters - quote and execution. Quoted is as good as the current price (and not equal). The others are Execution.

Quoted limiters must be executed in the tester exactly at the stated price.

Execution-limits - at the price of the tick on which it is set (SellLimit - Bid, BuyLimit - Ask), as if they are not limits, but marques.


Will there be this logic?

 
fxsaber:

Quoted limiters must be executed in the tester exactly at the quoted price.

Yes

Execution Limits - at the price of the tick, on which it is set (SellLimit - Bid, BuyLimit - Ask), as if they are not limits, but markets.
To be more precise - for exchange Limit orders placed at the better market price (higher Ask for BuyLimit and lower Bid for SellLimit) will be executed (activated) immediately after being placed (without waiting for the next price) at the current market price (Ask for BuyLimit, Bid for SellLimit).