Новая версия платформы MetaTrader 5 build 2715: Общие улучшения - страница 24

 

Билд 2715, сервер XPMT5-PRD

За 5 минут до закрытия торговой сессии советник шлет 4 приказа на закрытие 4 позиций, везде получает Result.retcode = 10009 (Request completed).

В списке ордеров появляется 4 соответствующих ордера:


После этого все запросы советника получают Result.retcode = 10039 (A close order already exists for a specified position).

Так продолжается и на пре-маркете на следующий день (08:55).

В 09:04 пользователь вручную удаляет селл-ордера, и советник тут же успешно закрывает позиции.


Спецификации у брокера настроены криво, ему уже написали:



Логи MT4ORDERS успешной отправки первого приказа на закрытие:

ND      0       18:25:17.960    CommunityPower MT5 (WING21,M5)  Line = 1499
GN      0       18:25:17.961    CommunityPower MT5 (WING21,M5)  MT4ORDERS::HistorySelectOrder(Result.order) = false
KK      0       18:25:17.961    CommunityPower MT5 (WING21,M5)  MT4ORDERS::HistorySelectDeal(Result.deal) = false
LF      0       18:25:17.961    CommunityPower MT5 (WING21,M5)  ::OrderSelect(Result.order) = true
CQ      0       18:25:17.961    CommunityPower MT5 (WING21,M5)  Result.deal = 0
MI      0       18:25:17.961    CommunityPower MT5 (WING21,M5)  
QR      0       18:25:17.961    CommunityPower MT5 (WING21,M5)  MT4ORDERS - not Sync with History!
PK      0       18:25:17.961    CommunityPower MT5 (WING21,M5)  Please send the logs to the coauthor - https://www.mql5.com/en/users/fxsaber
RK      0       18:25:17.961    CommunityPower MT5 (WING21,M5)  C:\Program Files\MetaTrader TESTE - ActivTrades\MQL5\Logs\20210111.log
FE      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  MT4Orders.mqh
NO      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Version = 2020.12.06
JI      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Compiler = 2734
EQ      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  2020.12.31 = 2020.12.31 00:00:00
FN      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::AccountInfoString(ACCOUNT_SERVER) = XPMT5-PRD
RI      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  (ENUM_ACCOUNT_TRADE_MODE)::AccountInfoInteger(ACCOUNT_TRADE_MODE) = ACCOUNT_TRADE_MODE_REAL (2)
GQ      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  (bool)::TerminalInfoInteger(TERMINAL_CONNECTED) = true
GD      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::TerminalInfoInteger(TERMINAL_PING_LAST) = 200142
CI      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::TerminalInfoDouble(TERMINAL_RETRANSMISSION) = 0.1992352372075881
RI      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::TerminalInfoInteger(TERMINAL_BUILD) = 2715
HM      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  (bool)::TerminalInfoInteger(TERMINAL_X64) = true
NN      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  (bool)::TerminalInfoInteger(TERMINAL_VPS) = false
RG      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  (ENUM_PROGRAM_TYPE)::MQLInfoInteger(MQL_PROGRAM_TYPE) = PROGRAM_EXPERT (2)
ND      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::TimeCurrent() = 2021.01.11 18:25:00
JK      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::TimeTradeServer() = 2021.01.11 18:25:17
HM      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  MT4ORDERS::TimeToString(MT4ORDERS::GetTimeCurrent()) = 2021.01.11 18:25:00.114
PO      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  MT4ORDERS::TimeToString(PrevTimeCurrent) = 2021.01.11 18:25:00.114
KM      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  PrevTick = Symb = WING21 time = 2021.01.11 18:25:00.114 bid = 125410 ask = 121400 last = 123405 volume = 19 0
NN      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  CurrentTick = ::SymbolInfoTick(Symb,Tick) = true Symb = WING21 time = 2021.01.11 18:25:00.114 bid = 125410 ask = 121400 last = 123405 volume = 19 0
GH      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::SymbolInfoString(Request.symbol,SYMBOL_PATH) = BMF\WING21
OE      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::SymbolInfoString(Request.symbol,SYMBOL_DESCRIPTION) = IBOVESPA MINI
DK      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::PositionsTotal() = 4
HM      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::OrdersTotal() = 1
JI      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::HistorySelect(0,INT_MAX) = true
CJ      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::HistoryDealsTotal() = 329
FN      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::HistoryOrdersTotal() = 360
PF      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::HistoryDealGetTicket(::HistoryDealsTotal()-1) = 199943436
HG      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  DEAL_ORDER = 789236977
CP      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  DEAL_TIME_MSC = 2021.01.11 16:46:40.498
PD      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::HistoryOrderGetTicket(::HistoryOrdersTotal()-1) = 789236977
LF      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ORDER_TIME_DONE_MSC = 2021.01.11 16:46:40.498
GE      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::TerminalInfoInteger(TERMINAL_MEMORY_AVAILABLE) = 7549
FL      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::TerminalInfoInteger(TERMINAL_MEMORY_PHYSICAL) = 4095
QN      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::TerminalInfoInteger(TERMINAL_MEMORY_TOTAL) = 8190
GD      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::TerminalInfoInteger(TERMINAL_MEMORY_USED) = 641
KG      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::MQLInfoInteger(MQL_MEMORY_LIMIT) = 8388608
RN      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  ::MQLInfoInteger(MQL_MEMORY_USED) = 2
CS      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  MT4ORDERS::IsHedging = true
RK      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Res = false
KR      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  MT4ORDERS::OrderSendBug = 0
NH      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.action = TRADE_ACTION_DEAL (1)
EG      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.magic = 0
HO      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.order = 0
DH      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.symbol = WING21
ER      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.volume = 3.0
JH      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.price = 123405.0
KR      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.stoplimit = 0.0
QF      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.sl = 0.0
RN      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.tp = 0.0
PJ      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.deviation = 50
HG      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.type = ORDER_TYPE_SELL (1)
JS      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.type_filling = ORDER_FILLING_RETURN (2)
FH      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.type_time = ORDER_TIME_GTC (0)
LK      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.expiration = 1970.01.01 00:00:00
GO      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.comment = CP WIN #4
QF      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.position = 789236977
CD      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Request.position_by = 0
RR      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Result.retcode = 10009
JK      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Result.deal = 0
NM      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Result.order = 789968478
CK      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Result.volume = 3.0
EN      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Result.price = 0.0
MG      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Result.bid = 0.0
IN      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Result.ask = 0.0
DI      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Result.comment = Request executed 215.148 + 1000.096 (0) ms.
FH      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Result.request_id = 5
LS      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  Result.retcode_external = 0
NO      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  
CM      0       18:25:18.002    CommunityPower MT5 (WING21,M5)  |  OrderClose( 789236977, 3.00, 123405, 50 ) - ERROR #10009 (Request completed)! Work time: 1.3 sec


Лог MT4ORDERS последней неуспешной попытки закрытия перед удалением ордера вручную:

RG      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  ::TimeCurrent() = 2021.01.12 09:04:43
EJ      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  ::TimeTradeServer() = 2021.01.12 09:04:44
EN      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  MT4ORDERS::TimeToString(PrevTimeCurrent) = 2021.01.12 09:04:43.551
MN      0       09:04:44.263    CommunityPower MT5 (WING21,M5)   Symb = WING21 time = 2021.01.12 09:04:43.551 bid = 123680 ask = 123685 last = 123685 volume = 2 0
QS      0       09:04:44.263    CommunityPower MT5 (WING21,M5)   ::SymbolInfoTick(Symb,Tick) = true Symb = WING21 time = 2021.01.12 09:04:43.733 bid = 123680 ask = 123685 last = 123685 volume = 1 0
EK      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.action = TRADE_ACTION_DEAL (1)
JF      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.magic = 0
CO      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.order = 0
GK      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.symbol = WING21
IS      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.volume = 2.0
OG      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.price = 123685.0
PR      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.stoplimit = 0.0
NF      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.sl = 0.0
QO      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.tp = 0.0
KJ      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.deviation = 50
GG      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.type = ORDER_TYPE_SELL (1)
ER      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.type_filling = ORDER_FILLING_RETURN (2)
IH      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.type_time = ORDER_TIME_GTC (0)
KK      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.expiration = 1970.01.01 00:00:00
IL      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.comment = CP WIN #3
CF      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.position = 787213391
DD      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Request.position_by = 0
HS      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Result.retcode = 10039
ED      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Result.deal = 0
GR      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Result.order = 0
EJ      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Result.volume = 0.0
NL      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Result.price = 0.0
RE      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Result.bid = 0.0
RL      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Result.ask = 0.0
HK      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Result.comment = Order to close this position already exists 199.197 ms
GK      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Result.request_id = 1228
GS      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  Result.retcode_external = 0
IO      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  
IO      0       09:04:44.263    CommunityPower MT5 (WING21,M5)  |  OrderClose( 787213391, 2.00, 123685, 50 ) - ERROR #10039 (A close order already exists for a specified position)! Work time: 199 ms
 

Также интересны цены, которые были перед закрытием ранка (они и спровоцировали закрытие позиций):
bid = 125410 ask = 121400 last = 123405

Понимаю, что стакан может становиться пустым, но чтобы бид взелетел настолько выше аск-а?

 
Vladimir Karputov:

Вероятно потому, что у этого шрифта нет размера 10:

Когда лэйбу помещаешь на график, то в ее свойствах есть. Наверное, тогда список нужно поправить.


 
Vladimir Karputov:

Вероятно потому, что у этого шрифта нет размера 10:

Хотя на Вашей картинке из свойств ME есть размеры 9 и 12, но переключение метки на графике между 9 и 12 ничего не меняет.
 
Vasiliy Pushkaryov:
Хотя на Вашей картинке из свойств ME есть размеры 9 и 12, но переключение метки на графике между 9 и 12 ничего не меняет.

Разрешение дисплея в пикселях? Настройки отображения масштаба в операционной системе? 

 
Vladimir Karputov:

Разрешение дисплея в пикселях? Настройки отображения масштаба в операционной системе? 

1440*900, масштаб мелкий - 100%.
 
Vladimir Pastushak:

По делу, даже реальные тики не воспроизведут в тестере стратегий то что было в реале. 

В реале, при большом количестве тиков за короткое время в процессе работы эксперта, некоторые тики могут пропускаться, если тик пришёл а эксперт не завершил проход. Это поведение Вы не перенесете на тестер...

ну так fxsaber об этом и писал. В реале может прийти несколько тиков пока советник отрабатывает предыдущий. 
Бороться с этим так: 

 

if(Real)
     {
      ulong static cur_time = 0;
      ulong static last_time = TimeCurrent() * 1000;
      cur_time = TimeCurrent() * 1000;
      MqlTick Ticks[];
      int count = CopyTicksRange(_Symbol, Ticks, COPY_TICKS_INFO, last_time, cur_time);
      last_time = cur_time;
      for(int i = 0; i < count; i++)
        {
         ask = Ticks[i].ask;
         bid = Ticks[i].bid;
         CalcCh();
        }
     }


   if(!Real)
     {
      MqlTick t;
      SymbolInfoTick(Symbol(), t);
      ask = t.ask;
      bid = t.bid;
      CalcCh();
     }

В функции Calc() происходят все расчеты. 

 
Vasiliy Pushkaryov:
1440*900, масштаб мелкий - 100%.

У меня так: Дисплей 1920 * 1080 (рекомендуется), масштаб и разметка 100% (мелкий)

 
Vladimir Karputov:

У меня так: Дисплей 1920 * 1080 (рекомендуется), масштаб и разметка 100% (мелкий)

У Вас тоже из трех имеющихся размеров в свойствах "Terminal" - 9, 10, 12 - отображение одинаковое. Я просто обратил внимание разработчиков, что есть недоработка, меняю размер шрифта, а ничего не меняется.
 

Крутой баг в дебаггере. И это не тавтология.

Код:

struct t {
        string  s1;
        string  s2;
};



const t s[] = {
        { "",   "1" },
        { "",   "2" }
};



void
OnStart() {
        string b = "";
        for (int i = ArraySize(s) - 1; i >= 0; --i) {
                Print(i);
                if (s[i].s2 != b) {
                        Print(i);
                        continue;
                }
                
                break;
        }
}

В билде 2741 нормальное поведение (в релизе и дебаге):

2021.01.12 19:44:42.530 t (EURUSD,M1)   1
2021.01.12 19:44:42.530 t (EURUSD,M1)   1
2021.01.12 19:44:42.530 t (EURUSD,M1)   0
2021.01.12 19:44:42.530 t (EURUSD,M1)   0


В билдах 2743, 2744  (только в дебаге):

2021.01.12 19:46:25.355 t (EURUSD,H1)   1
2021.01.12 19:46:25.357 t (EURUSD,H1)   24
2021.01.12 19:46:25.357 t (EURUSD,H1)   23
2021.01.12 19:46:25.357 Message Critical error while running script 't (EURUSD,H1)'.
2021.01.12 19:46:25.357 Message Array out of range.
Причина обращения: