MT5 and speed in action - page 27

 
fxsaber:

Which Terminal do you think consumes more CPU?

2 and here's why

 
fxsaber:

To reduce the CPU I recommend closing all sub-windows of the terminal (Market Watch, Navigator, Tools, etc.), minimising all charts and minimising the terminal itself.

Remove all unused symbols from the Market Watch. It is especially important for VPS.


I suggest to automate these actions somehow. Before you leave your VPS, press and leave. When you come in - press, you see everything.

I have been saying for a long time that the algotraders need another version of the terminal, without all this tuning!

In addition to all of the above, I've added a new one for each EA:

ChartSetInteger(0,CHART_SHOW,false);

Still lags :(

 
A100:

The 2nd and that's why.

Yes, the second one.

 
How is SymbolInfoTick architected? There is no understanding of why it can run for tens of milliseconds.
 

The b2560 loses enormously in performance compared to the b2592. Looking forward to fixing the bug.

The thread has turned out to be useful.

 
fxsaber:

The b2560 loses enormously in performance compared to the b2592. Waiting for bug fix.

b2593 has been fixed. Thank you!

 
Adding the order/trade to the trading history will cause a full rebuild of the HistorySelect cache, not a partial one. Hence lags in triggering of orders.
// Демонстрация полного (не частичного) пересбора HistorySelect-кеша.
#include <fxsaber\Benchmark.mqh> // https://c.mql5.com/3/321/Benchmark.mqh

input int inAlertTime = 1; // Нижний порог в миллисекундах

#define _B2(A) _B(A, inAlertTime)

const bool Init = EventSetTimer(1);

void OnTimer()
{
  static MqlTradeRequest Request = {0};
  static MqlTradeResult Result = {0};

  if (PositionSelectByTicket(Result.order)) // Если позиция открыта - закрываем.
  {
    Request.type = ORDER_TYPE_SELL;
    Request.price = SymbolInfoDouble(_Symbol, SYMBOL_BID);
    Request.position = Result.order;
  }
  else // Иначе - открываем.
  {
    Request.action = TRADE_ACTION_DEAL;
    Request.type = ORDER_TYPE_BUY;
    Request.symbol = _Symbol;
    Request.volume = 0.1;
    Request.price = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
    Request.position = 0;
  }

  if (OrderSend(Request, Result))
    _B2(HistorySelect(0, INT_MAX));
}

Result.
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.


Why it matters. Let's imagine that an HFT robot is running. On the same account a trade is executed by hand. That's it, the HFT-robot has dropped the HistorySelect-cache with the appropriate consequences. Of course, the history of HFT-robot is not 10K orders/trades, but much more. It would be expensive to rebuild the entire cache for such a history. That's why it is logical to add them.


It is clear that manual trading should not slow down robots. For pure algorithmic trading, the problem arises when the orders are triggered.

 

The functions allowing to make full (arrays of structures) snapshots of the current trading environment (positions and orders) are very much missing.

A variant through Position* and Order* functions causes collisions (active trading) when passing these two lists in the loop. Something is lost or not accounted for.

Instant full snapshots would avoid these problems.


ZZY Full snapshots for Market Watch - not assessing the relevance yet. Making MT5 closer to HFT (LCI).

 

Managed (not on purpose) to get the Terminal (and none) into a state where the CPU is 100% and the OrderSend wait time is over a second.

Probably won't be easy to find the cause.


ZZY It seems that such brakes are caused by a similar design.

void OnTrade()
{
  OnTick();
}

I haven't managed to create any code to reproduce it.


Fact, it is possible to drive the Terminal into a state where trade orders will be executed in seconds (Terminal log) with a ping of 50 ms. Once the EAs are removed, the trade orders start to be executed within 100ms.

 
fxsaber:

The functions allowing to make full (arrays of structures) snapshots of the current trading environment (positions and orders) are very much missing.

A variant through Position* and Order* functions causes collisions (active trading) when passing these two lists in the loop. Something is lost or not accounted for.

Instant full snapshots would avoid these problems.


ZZY Full snapshots for Market Watch - not assessing the relevance yet. Making MT5 closer to HFT (LCHI).

And full time functions to track order-transaction-position by ticket and backwards by ticket position to understand what the order was and the terms of the transaction. Tracking by history status is a wicked reality.

The full click environment is cool, but apparently expensive and not so often needed. although in a collapse of the market))))

For myself I divide an order and an order. An order to execute an order is a pending order. The market order is confusing.

Do not judge strictly by non-professional opinion.

Reason: