Stock market. Stocks. Speed of trade order execution. - page 8

 
Replikant_mih #:

Can't what?) The best offer - 10.1, I throw a limit to buy at 11, collect the entire cup to 11 if the volume in the cup to 11 is not enough to fulfill the entire application, or stop somewhere in the middle. If it's necessary that it should be exactly fulfilled, well, to make a bigger slam and that's all. If I wanted my order to be filled precisely, I would have to raise the maximum price and set a price somewhere in front of it, if I wanted my order to be filled precisely. In general, if I sweep the entire glass to a great depth - for me it's more like a signal that I'm doing something wrong))).


IOC - well, you perform everything in the way, then you remove the rest. So much for IOC). I don't trade arbitrage, maybe I don't understand some narrow specifics. If you want to eat all requests up to some level - well, you can watch what volume is there, and throw to Rosno this much, if you are not satisfied with variant of remainder withdrawal. In short, the task is not clear to me).

I already spoke, that so I do in Quick

procedure TExpert.SellBuySpot;
var
  outStr, id: string;
  res: long;
  ErrCode: long;
  ErrSize: Dword;
  ErrStr: LPSTR;
  Dt: TDateTime;
begin
  FOrder:= 0;
  FTransID:= GetTransID();
  id:= IntToStr(TransID);
  case BuySell of
    1: outStr:= 'ACCOUNT=' + ExpData.SpotAccaunt + '; CLIENT_CODE=' +
               ExpData.Client + '; TYPE=L; TRANS_ID=' + id + '; CLASSCODE=' +
               ExpData.SpotData.ClassCode + '; SECCODE=' + ExpData.SpotData.SecCode +
               '; ACTION=NEW_ORDER; OPERATION=B' + '; PRICE=' +
               FloatToStr(ExpData.SpotData.SellPrice + 10 * ExpData.SpotData.Step) +
               '; QUANTITY=' + FloatToStr(aVol) + ';';
    2: outStr:= 'ACCOUNT=' + ExpData.SpotAccaunt + '; CLIENT_CODE=' +
               ExpData.Client + '; TYPE=L; TRANS_ID=' + id + '; CLASSCODE=' +
               ExpData.SpotData.ClassCode + '; SECCODE=' + ExpData.SpotData.SecCode +
               '; ACTION=NEW_ORDER; OPERATION=S' + '; PRICE=' +
               FloatToStr(ExpData.SpotData.BuyPrice - 10 * ExpData.SpotData.Step) +
               '; QUANTITY=' + FloatToStr(aVol) + ';';
  end;
  ErrCode:= 0;
  ErrSize:= 0;
  ErrStr:= nil;
  res:= T2QSendASyncTrans(LPSTR(AnsiString(outStr)), ErrCode, ErrStr, ErrSize);
  if(res <> TRANS2QUIK_SUCCESS) then
  begin
    FTransID:= 0;
    FTransBusy:= false;
  end else
  begin
    Dt:= now();
    FMemo.Lines.Add(DateToStr(Dt) + ' ' + FormatDateTime('hh:mm:ss.zzz', Now()) +
                              ' --> Ордер ' + ExpData.SpotData.SecCode + ' отправлен.');
  end;
end;

But sometimes (it happens rarely) order remains in the glass, therefore

It has to be removed and set a new one and watch again - all this takes too much time.

In addition, it may close before you get to take it off!

That is why the most reliable is IOC, but it is not on the spot.

In arbitrage, everything is very simple, if you bought 100 units of one leg, then you must immediately sell 100 units of another leg (the key word IMMEDIATELY).

So the challenge is to make a counter trade as quickly as possible at the right price and volume.

Added by

In MT-5 everything is much simpler, faster and there are options

For example, there is no problem to run through the SPOT deck and take not the best price at once, having calculated the total volume of selected price + previous (best) prices

That's why I was worried about the speed of execution of trade orders on the Stock in MT-5.

But all the same, there's no guarantee that the market will change dramatically, and if you take the price too deep, you can go outside the arbitrage situation!

In Quick, the transaction speed on SPOT was from 240 to 490 ms, with a ping of 3-4 ms!

On FORTS, at the same ping, the transaction goes from 4.5 to 12 ms.

Unfortunately, due to low liquidity on Forts, you have to sell the futures first.

 
prostotrader #:

I've already said that's what I do in Quick

But sometimes (it's rare but it happens) order remains in the glass, therefore

Therefore I have to take it off and set a new one and watch it again - all this takes too much time.

In addition, the order may be executed, while you are about to take it out!

That is why the most reliable is IOC, but it is not on the spot.

In arbitrage, everything is very simple, if you bought 100 units of one leg, then you must immediately sell 100 units of another leg (the key word IMMEDIATELY).

So the challenge is to make a counter trade as quickly as possible at the right price and volume.

Added by

In MT-5 everything is much simpler, faster and there are options

For example, there is no problem to run through the SPOT deck and take not the best price at once, having calculated the total volume of selected price + previous (best) prices

That's why I was worried about the speed of execution of trade orders on the Stock in MT-5.

But all the same, there's no guarantee that the market will change dramatically, and if you take the price too deep, you can go outside the arbitrage situation!

In Quick, the transaction speed on SPOT was from 240 to 490 ms, with a ping of 3-4 ms!

On FORTS, at the same ping, the transaction goes from 4.5 to 12 ms.

Unfortunately, due to low liquidity on forts, you have to sell the futures first.


Got it.
Is it real to arbitrage the stock against the futures on mt5-Quik? Or do I need some "intellectual" component to somehow compete with my speedy fellows?

 
Replikant_mih #:


Got it.
Is it realistic to arbitrage the stock against the futures at mt5-Quik speeds? Or do I need some "intellectual" component to somehow compete with speedy fellows?

If only Classic, then Quick is good enough, and if, as I want to try, scalping, then I need at least MT-5 (2 terminals)

 
prostotrader #:

If only Classic, then Quick is good enough, and if, as I want to try, scalping, then I need at least MT-5 (2 terminals)

2 because the broker does not allow to trade shares and futures in one terminal (like in Otkritie) or because everything works in your terminals connection and there will be no need to change anything? Just mt5-mt5 instead of mt5-Quik.

 
Replikant_mih #:

2 because the broker does not allow you to trade both stocks and futures in one terminal (like Otkritie) or because everything works in your terminal connection and therefore you won't need to redo anything? It will just be mt5-mt5 instead of mt5-Quik.

No, it's only quik now, I've started writing mt5 - mt5

Added by

Well, there you have it, written.

Now, it's not clear when it will be possible to test...


 
prostotrader #:

No, now only Quick, I started writing MT5 - MT5

Added by

Well, here it is, written.

Now, it's not clear when it will be possible to test it...


Congratulations!

And how do you plan - for each pair of spot futures your EA or one EA for all pairs?

 
Andrey Miguzov #:

Congratulations!

How do you plan - for each pair of spot futures a different EA or one EA for all pairs?

My own client-server set for each pair

Why the headache of tracking all futures and SPOTs from one EA?

The EA is essentially just one (client), the server is just a performer - a crutch for buying SPOTs :)

Added

Advisor - the client automatically sends (receives) to (from) the server all the necessary data.

It doesn't matter which pair, the advisor adjusts to the futurespot pair automatically.

 
prostotrader #:

Why the headache of tracking all the futures and SPOTs from one EA.

Honestly speaking, I was greatly inspired by your screenshots from my personal account at Otkritie and I am still debugging the Expert Advisor for trading futures-stocks (not scalping, but the classics in head-on mode).

The logical approach is to enter the pair with larger profit before expiration (taking into account the commission and the actual number of contracts).

Accordingly, we must analyze all actual pairs. If one sets an EA for each pair - they will work independently of each other.

The headache is indeed present, especially when closing positions on one pair and switching to another. Plus I think it will slow down when there are a lot of pairs.


ZZZ: Given the current value of rates, in the near future, the profitability of such a strategy will be even greater, if the exchange is opened of course :)

I see from the video + you yourself wrote that you write for scalping. Is the average entry and exit - is it the average EMA (link) or are you averaging it somehow else (if it's not a secret)?

 
Andrey Miguzov #:

Is the average input and output the average EMA (link) or are you averaging it somehow else (if it's not a secret)?

There is no secret, I just calculate the average every time I access the function

exp_data.midle_enter = exp_data.midle_enter * exp_data.m_ent_cnt;
  exp_data.m_ent_cnt++;
  exp_data.midle_enter = (exp_data.midle_enter + result)/exp_data.m_ent_cnt; 

exp_data.midle_exit = exp_data.midle_exit * exp_data.m_exit_cnt;
  exp_data.m_exit_cnt++;
  exp_data.midle_exit = (exp_data.midle_exit + result)/exp_data.m_exit_cnt;

This data is needed to understand the price level of this pair.

 
prostotrader #:

There is no secret, I just calculate the average every time the function is called.

I need this data to understand the price level of a given pair.

I see, if in waving terms, it'sthe SMA. But the further from the beginning of calculation, the farther the average value will depart from the current one.

Roughly, this method of averaging does not "forget" the old values, because exp_data.m_ent_cnt increases more and more with each call and each new value has less and less effect on the final result.

According to my observations, the average value changes during the day and is quite sensitive.

In theory EMA should be more suitable for scalping, the code will be approximately as follows:

double EMA_period = 100.0; //Период ЕМА для усреднения, тиков
double SmoothFactor = 2.0/(1.0+EMA_period);
 
if (EMA_ask<0) EMA_ask=ask; //первый тик
   else
  EMA_ask=ask*SmoothFactor+EMA_ask*(1.0-SmoothFactor);
Reason: