MT5 and speed in action - page 28

 
fxsaber:
Adding an order/trade to the trading history causes the HistorySelect cache to be rebuilt completely, not partially. Hence the lags in triggering of pending orders.

b2595 - corrected, Great!

Checked on the wrong story, haven't fixed it yet.

 

Forum on trading, automated trading systems and trading strategy testing

MT5 and Speed in Action

fxsaber, 2020.09.08 19:46

2020.09.08 20:23:32.103 Alert: Time[Test6.mq5 411: HistorySelect(0,INT_MAX)] = 5 ms.
2020.09.08 20:23:32.239 Alert: Time[Test6.mq5 411: HistorySelect(0,INT_MAX)] = 5 ms.
2020.09.08 20:31:59.863 Alert: Time[Test6.mq5 433: HistorySelect(0,INT_MAX)] = 9 ms.
2020.09.08 20:32:00.845 Alert: Time[Test6.mq5 433: HistorySelect(0,INT_MAX)] = 5 ms.
2020.09.08 20:32:01.856 Alert: Time[Test6.mq5 433: HistorySelect(0,INT_MAX)] = 4 ms.
2020.09.08 20:32:02.846 Alert: Time[Test6.mq5 433: HistorySelect(0,INT_MAX)] = 7 ms.

b2596 has become faster, it seems.

2020.09.11 05:06:17.854 Alert: Time[Test6.mq5 433: HistorySelect(0,INT_MAX)] = 1 ms.
2020.09.11 05:06:18.853 Alert: Time[Test6.mq5 433: HistorySelect(0,INT_MAX)] = 1 ms.
2020.09.11 05:06:19.875 Alert: Time[Test6.mq5 433: HistorySelect(0,INT_MAX)] = 1 ms.
2020.09.11 05:06:20.871 Alert: Time[Test6.mq5 433: HistorySelect(0,INT_MAX)] = 1 ms.
 
b2605 - no more alerts. A great job done, thank you!
MT5 и скорость в боевом исполнении
MT5 и скорость в боевом исполнении
  • 2020.09.07
  • www.mql5.com
MT5 - шустрая платформа. Но есть узкие горлышки, которые сводят на нет все старания быстрой торговли...
 

Can you tell me what to do to avoid this kind of thing when trading?

2020.09.15 22:17:04.633 Alert: Time[NewTicks.mqh 33: ::SymbolInfoTick(_Symbol,Tick)] = 13 ms.
2020.09.15 22:17:04.638 Alert: Time[NewTicks.mqh 33: ::SymbolInfoTick(_Symbol,Tick)] = 18 ms.
2020.09.15 22:17:04.640 Alert: Time[NewTicks.mqh 33: ::SymbolInfoTick(_Symbol,Tick)] = 20 ms.
 
Result of running this script on live terminal.
2020.09.15 22:26:41.788 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 484: OrderSelect(0)] = 1 ms.
2020.09.15 22:26:48.322 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 489: PositionsTotal()] = 2 ms.
2020.09.15 22:27:07.661 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 490: PositionSelect(Symb)] = 1 ms.
2020.09.15 22:27:47.228 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 483: OrdersTotal()] = 2 ms.
2020.09.15 22:27:53.039 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 483: OrdersTotal()] = 9 ms.
2020.09.15 22:28:13.858 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 490: PositionSelect(Symb)] = 1 ms.
2020.09.15 22:28:21.058 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 484: OrderSelect(0)] = 8 ms.
2020.09.15 22:28:47.813 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 489: PositionsTotal()] = 4 ms.
2020.09.15 22:28:51.482 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 505: AccountInfoInteger(ACCOUNT_TRADE_EXPERT)] = 4 ms.
2020.09.15 22:29:09.053 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 490: PositionSelect(Symb)] = 1 ms.
2020.09.15 22:29:09.353 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 506: AccountInfoInteger(ACCOUNT_TRADE_ALLOWED)] = 1 ms.
2020.09.15 22:29:28.814 Test6 (EURUSD,H1)       Alert: Time[Test6.mq5 457: HistorySelect(Tick.time,INT_MAX)] = 2 ms.

The last line is normal.


Can lags be affected by EAs running in parallel? No indicators.


SZY Profiling on empty terminal.

SymbolInfoTick is an expensive function.

 
fxsaber:

Can lags be affected by EAs running in parallel? There are no indicators.

I have launched an empty terminal in parallel and tried it. I have not seen the same thing.

Configuration.
2020.09.15 20:35:42.481 Terminal        Windows 10 build 19042, Intel Core i7-2700 K  @ 3.50 GHz, 6 / 15 Gb memory, 20 / 29 Gb disk, IE 11, Admin, GMT+3

Forum on trading, automated trading systems and strategy testing

MT5 and Speed in Action

fxsaber, 2020.09.01 21:59

Installed Win10, LatencyMon shows everything is fine.

 
In general, due to the fact that almost every regular function can cause braking, the battle Expert Advisor performs every OnTick for several tens of milliseconds. This amount is eaten up by the sum of calls to Order*+SymbolInfoTick+Position*, etc. There are no mathematical calculations. You need free snapshots. Without them, HDI on MT5 does not work.
 
fxsaber:
Anyway, due to the fact that almost every regular function can cause a slowdown, the battle Expert Advisor performs every OnTick for several tens of milliseconds. The sum of calls Order*+SymbolInfoTick+Position*, etc. eats that much. There are no mathematical calculations. You need free snapshots. Without them, HDI on MT5 does not work.

Something is wrong with the approach... Apparently, OnTrade functions are needed rather than scanning the state from scratch on every tick.

 
Andrey Khatimlianskii:

Something is wrong with the approach... Apparently, OnTrade functions are needed, rather than scanning the state from scratch on every tick.

The OOP paradigm assumes that each sub-TC scans the trading environment. However, if you really want to, you can break the independence of OOP objects a bit.

For example, make a full-fledged snapshot at the very beginning of OnTick. And it must be repeated only after the call of synchronous functions - OrderSend and CopyTicks.

As for OnTrade*, connection breaks screw up the scheme when snapshots are done only in OnTrade-functions. Otherwise, of course, there would be a big saving.

 
fxsaber:

The OOP paradigm assumes that each sub-OS scans the trading environment. However, if one really wants to, one can break the independence of OOP objects a bit.

For example, make a full-fledged snapshot at the very beginning of OnTick. And it will be repeated only after the call of synchronous functions - OrderSend and CopyTicks.

Of course, the snapshot object must be one.


fxsaber:

As for OnTrade*, link breaks screw up the scheme when snapshots are done only in OnTrade functions. Otherwise, of course, there would be a big saving.

Detect a connection break and force update the snapshot on the next tick, then go back to economy mode?

Reason: