MT5 and speed in action - page 32

 
Renat Fatkhullin:

Please respond to the status of this column.

Forum on trading, automated trading systems and trading strategy testing

New version of MetaTrader 5 build 2560: Improvements in embedded learning system

fxsaber, 2020.08.16 23:02

Trading history -> Positions -> Comment column is empty for all trades. This must be a mistake.

Not only is it empty, it also eats up a huge chunk of usable space.

 
fxsaber:

https://www.mql5.com/ru/docs/constants/tradingconstants/orderproperties#enum_order_state

Doesn't Started-state occur after a successful OrderSendAsync?

The status may occur, but the ticket does not.

The order simply passed a formal correctness check, not even a market match. The asynchronous order was simply passed on the pipeline and its fate will be decided somewhere else.

 
fxsaber:

Please respond to the status of this column.

Not only is it empty, but it eats up a huge chunk of usable space.

Yes, that's right.

They forgot to correctly move the comment when gathering virtual positions from deals in the history. Let's fix it.

 
Renat Fatkhullin:

The state can occur, but the ticket cannot.

This state cannot be seen because OrdersTotal() does not change.

 
fxsaber:

This state cannot be seen because OrdersTotal() does not change.

Don't knock on a missing door.

I have explained in detail - "the order has been checked for formal correctness and sent somewhere". This order has no number, it has only been passed on to the next step of the conveyor belt. It will only be given a number when it passes the execution queue.

You cannot get any more information on the asynchronous parcel. Your market/trading status will not change until you receive a step-by-step detail on your asynchronous request after some time, which you can catch in OnTradeTransaction.

Документация по MQL5: Основы языка / Функции / Функции обработки событий
Документация по MQL5: Основы языка / Функции / Функции обработки событий
  • www.mql5.com
В языке MQL5 предусмотрена обработка некоторых предопределенных событий. Функции для обработки этих событий должны быть определены в программе MQL5: имя функции, тип возвращаемого значения, состав параметров (если они есть) и их типы должны строго соответствовать описанию функции-обработчика события. Именно по типу возвращаемого значения и по...
 
Renat Fatkhullin:

Don't knock on an absent door.

I have explained in detail - "the order has been checked for formal correctness and sent somewhere". This order has no number, it has just been passed on to the next step of the conveyor belt. It will only be given a number when it passes the execution queue.

You cannot get any more information on the asynchronous parcel. Your market/trade state won't change until you get a step-by-step detail on your asynchronous request after some time, which you can catch in OnTradeTransaction.

Thanks for the clarification, will investigate.

 

The story may have grown.

But on b2617 this EA has gone back to alerts.

Forum on trading, automated trading systems and trading strategy testing

MT5 and Speed in Action

fxsaber, 2020.09.08 19:46

// Демонстрация полного (не частичного) пересбора 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));
}
 

Check on beta 2619, please.

We have made a number of optimisations to speed up history sampling. There was a case of forced cache invalidation.

 
Renat Fatkhullin:

Check on beta 2619, please.

We have made a number of optimisations to speed up history sampling. There was a case of forced cache invalidation.

The acceleration happened, but unfortunately for some reason the cache update is not in one millisecond, so it alerts at every step where the history was updated.

2020.09.24 05:17:49.541 Alert: Time[Test6.mq5 460: HistorySelect(0,INT_MAX)] = 1 ms.
2020.09.24 05:17:49.543 Alert: Time[Test6.mq5 460: HistorySelect(0,INT_MAX)] = 1 ms.
2020.09.24 05:17:50.526 Alert: Time[Test6.mq5 460: HistorySelect(0,INT_MAX)] = 1 ms.
2020.09.24 05:17:50.527 Alert: Time[Test6.mq5 460: HistorySelect(0,INT_MAX)] = 1 ms.
2020.09.24 05:17:51.569 Alert: Time[Test6.mq5 460: HistorySelect(0,INT_MAX)] = 1 ms.
2020.09.24 05:17:51.571 Alert: Time[Test6.mq5 460: HistorySelect(0,INT_MAX)] = 1 ms.
2020.09.24 05:17:52.530 Alert: Time[Test6.mq5 460: HistorySelect(0,INT_MAX)] = 1 ms.
2020.09.24 05:17:52.532 Alert: Time[Test6.mq5 460: HistorySelect(0,INT_MAX)] = 1 ms.


Please try it on a larger history.


I assume this millisecond is due to memory allocation for cache refresh. Nothing else seems to be slowing it down.

 
fxsaber:

Thanks for the clarification, I will look into it.

Put your flags up, it's an old topic.