Библиотеки: Tester - страница 18

 

Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий

Библиотеки: Tester

hini, 2025.06.13 02:55

В вашем примере кода значение TickSize выводится как 0. Почему так происходит?

int OnInit() { Print(_Symbol, " ", _V(0, SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE))); return(INIT_SUCCEEDED); }
void OnDeinit( const int ) {}


Не проверял, но предполагаю, что так должно сработать. Virtual значительно изменился после публикации Tester.mqh. В частности, появилась мультивалютность, что потребовало хранение TiсkSize и некоторых других свойств.


Это одна из причин, почему в Report.mqh пришлось прибегнуть к такой конструкции.

  // См. ORDERS::SymbolInfoDouble.
  static double SymbolInfoDouble2( const string Symb, const ENUM_SYMBOL_INFO_DOUBLE Property )
  {
  #ifdef __VIRTUAL__
    return(_V(0, ::SymbolInfoDouble(Symb, Property)));
  #else // #ifdef __VIRTUAL__
    return(::SymbolInfoDouble(Symb, Property));
  #endif // #ifdef __VIRTUAL__ #else
  }


Вот сама причина в Virtual.

  // Где-то логично этому находиться в SYMBOL_BASE.
  virtual double SymbolInfoDouble( const string &Symb, const ENUM_SYMBOL_INFO_DOUBLE Property )
  {
    _VC

    // Если OrderSymbol() != SymbolBase (в Virtual-историю можно писать любые символы), то будут неправильные данные.
    switch (Property)
    {
      case SYMBOL_BID:
        return(this.CurrentTick.bid);
      case SYMBOL_ASK:
        return(this.CurrentTick.ask);
      case SYMBOL_POINT:
        return(this.SymbolBase.Point);
      case SYMBOL_TRADE_TICK_VALUE:
      case SYMBOL_TRADE_TICK_VALUE_LOSS:
      case SYMBOL_TRADE_TICK_VALUE_PROFIT:
        return(this.SymbolBase.TickValue * this.SymbolBase.TickSize);
      case SYMBOL_TRADE_TICK_SIZE:
        return(this.SymbolBase.TickSize);
    }

    return(::SymbolInfoDouble(Symb, Property));
/*
    return((Property == SYMBOL_BID) ? this.CurrentTick.bid
                                    : ((Property == SYMBOL_ASK) ? this.CurrentTick.ask : ::SymbolInfoDouble(Symb, Property)));
*/
  }
 
fxsaber #:

Не проверял, но предполагаю, что так должно сработать. Virtual значительно изменился после публикации Tester.mqh. В частности, появилась мультивалютность, что потребовало хранение TiсkSize и некоторых других свойств.


Это одна из причин, почему в Report.mqh пришлось прибегнуть к такой конструкции.

Хорошо, я понял.

 

Доброго дня! Я обновил все библиотеки (скачивал вручную) при компиляции Tester_Example.mq5 получаю много ошибок. Возможно из-за обновлений MetaEditor. Может кто-нибудь проверить компилируемость на сегодняшний день? 

wrong parameters count, 2 passed, but 1 requires TesterBase.mqh 192 32
   void TESTERBASE::ChangeVelocity(const double) TesterBase.mqh 190 8
call resolves to 'void TESTERBASE::ChangeVelocity(const double)' instead of 'int TIMER::ChangeVelocity(const int,const double,const int,const int)' due to new rules of method hiding TesterBase.mqh 192 32
   see declaration of function 'TESTERBASE::ChangeVelocity' TesterBase.mqh 190 8
   see declaration of function 'TIMER::ChangeVelocity' Timer.mqh 15 7
undeclared identifier Report.mqh 966 45
')' - expression expected Report.mqh 966 51
implicit conversion from 'unknown' to 'string' Report.mqh 966 45
undeclared identifier Report.mqh 966 79
')' - expression expected Report.mqh 966 85
implicit conversion from 'unknown' to 'string' Report.mqh 966 79
undeclared identifier Report.mqh 967 73
')' - expression expected Report.mqh 967 90
undeclared identifier Report.mqh 969 133
')' - expression expected Report.mqh 969 150
undeclared identifier Report.mqh 1118 47
')' - expression expected Report.mqh 1118 64
undeclared identifier Report.mqh 1269 47
')' - expression expected Report.mqh 1269 64
undeclared identifier Report.mqh 1418 44
')' - expression expected Report.mqh 1418 61
undeclared identifier Report.mqh 1521 7
')' - expression expected Report.mqh 1521 7
undeclared identifier Report.mqh 1532 46
')' - expression expected Report.mqh 1532 63
undeclared identifier Report.mqh 1570 5
')' - expression expected Report.mqh 1570 5
undeclared identifier Report.mqh 1585 5
')' - expression expected Report.mqh 1585 5
undeclared identifier Report.mqh 1685 5
')' - expression expected Report.mqh 1685 5
undeclared identifier Report.mqh 1723 64
')' - expression expected Report.mqh 1723 81
undeclared identifier Report.mqh 1733 5
')' - expression expected Report.mqh 1733 5
undeclared identifier Report.mqh 2153 74
')' - expression expected Report.mqh 2153 91
declaration without type Report.mqh 2310 11
undeclared identifier Report.mqh 2311 5
undeclared identifier Report.mqh 2311 9
',' - unexpected token Report.mqh 2311 23
'VirtualPointer' - some operator expected Report.mqh 2311 9
undeclared identifier Report.mqh 2311 34
'+' - some operator expected Report.mqh 2311 48
undeclared identifier Report.mqh 2313 5
undeclared identifier Report.mqh 2313 16
'Order' - some operator expected Report.mqh 2313 16
undeclared identifier Report.mqh 2328 11
undeclared identifier Report.mqh 2328 28
')' - expression expected Report.mqh 2328 37
undeclared identifier Report.mqh 2331 50
')' - expression expected Report.mqh 2331 67
undeclared identifier Report.mqh 2336 13
undeclared identifier Report.mqh 2340 11
undeclared identifier Report.mqh 2340 15
',' - unexpected token Report.mqh 2340 29
'VirtualPointer' - some operator expected Report.mqh 2340 15
undeclared identifier Report.mqh 2340 40
undeclared identifier Report.mqh 2340 49
'Order' - some operator expected Report.mqh 2340 49
undeclared identifier Report.mqh 3407 44
')' - expression expected Report.mqh 3407 61
undeclared identifier Report.mqh 3421 45
')' - expression expected Report.mqh 3421 62
undeclared identifier Report.mqh 3620 9
'Total' - some operator expected Report.mqh 3620 23
undeclared identifier Report.mqh 3622 16
undeclared identifier Report.mqh 3623 45
variable expected Report.mqh 3623 45
   built-in: int ::StringReplace(const string,const string) Report.mqh 3623 31
undeclared identifier Report.mqh 3625 18
undeclared identifier Report.mqh 3625 23
',' - unexpected token Report.mqh 3625 44
implicit conversion from 'unknown' to 'string' Report.mqh 3625 23
'+' - some operator expected Report.mqh 3625 35
')' - unexpected token Report.mqh 3625 52
wrong parameters count, 1 passed, but 3 requires Report.mqh 4271 14
   bool VIRTUAL::VirtualOrderSelect(const long,const int,const int) Virtual.mqh 371 15
undeclared identifier Report.mqh 4289 52
')' - expression expected Report.mqh 4289 58
implicit conversion from 'unknown' to 'string' Report.mqh 4289 52
undeclared identifier Report.mqh 4289 85
')' - expression expected Report.mqh 4289 91
implicit conversion from 'unknown' to 'string' Report.mqh 4289 85
undeclared identifier Report.mqh 4290 61
')' - expression expected Report.mqh 4290 78
undeclared identifier Report.mqh 4290 117
')' - expression expected Report.mqh 4290 134
77 errors, 6 warnings   77 6

 
Sunriser #:

Доброго дня! Я обновил все библиотеки (скачивал вручную)

Дополнительный способ подстраховаться, что библиотека верно скачана - скомпилировать только ее.

при компиляции Tester_Example.mq5 получаю много ошибок. Возможно из-за обновлений MetaEditor. Может кто-нибудь проверить компилируемость на сегодняшний день? 

wrong parameters count, 2 passed, but 1 requires TesterBase.mqh 192 32
   void TESTERBASE::ChangeVelocity(const double) TesterBase.mqh 190 8
call resolves to 'void TESTERBASE::ChangeVelocity(const double)' instead of 'int TIMER::ChangeVelocity(const int,const double,const int,const int)' due to new rules of method hiding TesterBase.mqh 192 32
   see declaration of function 'TESTERBASE::ChangeVelocity' TesterBase.mqh 190 8
   see declaration of function 'TIMER::ChangeVelocity' Timer.mqh 15 7
undeclared identifier Report.mqh 966 45
')' - expression expected Report.mqh 966 51
implicit conversion from 'unknown' to 'string' Report.mqh 966 45
undeclared identifier Report.mqh 966 79
')' - expression expected Report.mqh 966 85
implicit conversion from 'unknown' to 'string' Report.mqh 966 79
undeclared identifier Report.mqh 967 73
')' - expression expected Report.mqh 967 90
undeclared identifier Report.mqh 969 133
')' - expression expected Report.mqh 969 150
undeclared identifier Report.mqh 1118 47
')' - expression expected Report.mqh 1118 64
undeclared identifier Report.mqh 1269 47
')' - expression expected Report.mqh 1269 64
undeclared identifier Report.mqh 1418 44
')' - expression expected Report.mqh 1418 61
undeclared identifier Report.mqh 1521 7
')' - expression expected Report.mqh 1521 7
undeclared identifier Report.mqh 1532 46
')' - expression expected Report.mqh 1532 63
undeclared identifier Report.mqh 1570 5
')' - expression expected Report.mqh 1570 5
undeclared identifier Report.mqh 1585 5
')' - expression expected Report.mqh 1585 5
undeclared identifier Report.mqh 1685 5
')' - expression expected Report.mqh 1685 5
undeclared identifier Report.mqh 1723 64
')' - expression expected Report.mqh 1723 81
undeclared identifier Report.mqh 1733 5
')' - expression expected Report.mqh 1733 5
undeclared identifier Report.mqh 2153 74
')' - expression expected Report.mqh 2153 91
declaration without type Report.mqh 2310 11
undeclared identifier Report.mqh 2311 5
undeclared identifier Report.mqh 2311 9
',' - unexpected token Report.mqh 2311 23
'VirtualPointer' - some operator expected Report.mqh 2311 9
undeclared identifier Report.mqh 2311 34
'+' - some operator expected Report.mqh 2311 48
undeclared identifier Report.mqh 2313 5
undeclared identifier Report.mqh 2313 16
'Order' - some operator expected Report.mqh 2313 16
undeclared identifier Report.mqh 2328 11
undeclared identifier Report.mqh 2328 28
')' - expression expected Report.mqh 2328 37
undeclared identifier Report.mqh 2331 50
')' - expression expected Report.mqh 2331 67
undeclared identifier Report.mqh 2336 13
undeclared identifier Report.mqh 2340 11
undeclared identifier Report.mqh 2340 15
',' - unexpected token Report.mqh 2340 29
'VirtualPointer' - some operator expected Report.mqh 2340 15
undeclared identifier Report.mqh 2340 40
undeclared identifier Report.mqh 2340 49
'Order' - some operator expected Report.mqh 2340 49
undeclared identifier Report.mqh 3407 44
')' - expression expected Report.mqh 3407 61
undeclared identifier Report.mqh 3421 45
')' - expression expected Report.mqh 3421 62
undeclared identifier Report.mqh 3620 9
'Total' - some operator expected Report.mqh 3620 23
undeclared identifier Report.mqh 3622 16
undeclared identifier Report.mqh 3623 45
variable expected Report.mqh 3623 45
   built-in: int ::StringReplace(const string,const string) Report.mqh 3623 31
undeclared identifier Report.mqh 3625 18
undeclared identifier Report.mqh 3625 23
',' - unexpected token Report.mqh 3625 44
implicit conversion from 'unknown' to 'string' Report.mqh 3625 23
'+' - some operator expected Report.mqh 3625 35
')' - unexpected token Report.mqh 3625 52
wrong parameters count, 1 passed, but 3 requires Report.mqh 4271 14
   bool VIRTUAL::VirtualOrderSelect(const long,const int,const int) Virtual.mqh 371 15
undeclared identifier Report.mqh 4289 52
')' - expression expected Report.mqh 4289 58
implicit conversion from 'unknown' to 'string' Report.mqh 4289 52
undeclared identifier Report.mqh 4289 85
')' - expression expected Report.mqh 4289 91
implicit conversion from 'unknown' to 'string' Report.mqh 4289 85
undeclared identifier Report.mqh 4290 61
')' - expression expected Report.mqh 4290 78
undeclared identifier Report.mqh 4290 117
')' - expression expected Report.mqh 4290 134
77 errors, 6 warnings   77 6

До обновления компилятора кодобазы рекомендую использовать b5147- билды ME.

Новая версия платформы MetaTrader 5 build 5200: расширение OpenBLAS и усиление контроля в MQL5
Новая версия платформы MetaTrader 5 build 5200: расширение OpenBLAS и усиление контроля в MQL5
  • 2025.08.29
  • www.mql5.com
В пятницу 1 августа 2025 года будет выпущена обновленная версия платформы MetaTrader 5...
 
fxsaber #:

Дополнительный способ подстраховаться, что библиотека верно скачана - скомпилировать только ее.

До обновления компилятора кодобазы рекомендую использовать b5147- билды ME.

Выше я писал, что все библиотеки скачал, сегодня понял, что не все! (не раскрыл полный список Virtual)

Вот сообщения компилятора для build 5200 с догруженными файлами. Он гораздо короче :)

ambiguous call to overloaded function TesterBase.mqh 173 49
could be one of 2 function(s) TesterBase.mqh 173 49
   int VIRTUAL::Create(const double,datetime,const bool) Virtual.mqh 259 14
   int VIRTUAL::Create(const string,const bool) Virtual.mqh 296 14
wrong parameters count, 2 passed, but 1 requires TesterBase.mqh 192 32
   void TESTERBASE::ChangeVelocity(const double) TesterBase.mqh 190 8
call resolves to 'void TESTERBASE::ChangeVelocity(const double)' instead of 'int TIMER::ChangeVelocity(const int,const double,const int,const int)' due to new rules of method hiding TesterBase.mqh 192 32
   see declaration of function 'TESTERBASE::ChangeVelocity' TesterBase.mqh 190 8
   see declaration of function 'TIMER::ChangeVelocity' Timer.mqh 15 7
'struct CPoint' initialized from type type 'CPoint' using assignment operator, this behavior is deprecated and will be removed in future Canvas.mqh 2898 17
   consider defining copy constructor 'CPoint(const CPoint&)' Rect.mqh 10 8
'struct SLIP' initialized from type type 'const REPORT::SLIP&' using assignment operator, this behavior is deprecated and will be removed in future Report.mqh 453 16
   consider defining copy constructor 'SLIP(const const REPORT::SLIP&&)' Report.mqh 334 10
 
Sunriser #:

Вот сообщения компилятора для build 5200 с догруженными файлами.

Изменения языка учтены давно, ждем обновления системы, чтобы можно было выкладывать коды в кодобазу с обновленным синтаксисом.
 
fxsaber #:
Изменения языка учтены давно, ждем обновления системы, чтобы можно было выкладывать коды в кодобазу с обновленным синтаксисом.

Библиотека обновлена.

 
fxsaber #:

Библиотека обновлена.

Спасибо! Теперь работает. А панелька https://www.mql5.com/ru/code/24829 видимо давно утратила совместимость? Попробую прикрутить самодельную.

TradePanel_Csharp
TradePanel_Csharp
  • 2019.02.28
  • www.mql5.com
Расширение графического интерфейса Терминала/Тестера.
 
Sunriser #:

А панелька https://www.mql5.com/ru/code/24829 видимо давно утратила совместимость?

 

Здравствуйте!

1. При перетаскивании советника Tester_Example на кастомный символ, создается новый график с префиксом TESTER_ и всё работает отлично.

Но если закрыть этот "TESTER_.."-график, или удалить с него советника, а потом закрыть график и повторить п.1, то тестирование начинается не с даты, заданной в настройках, а с той на которой тестирование было прервано.

Если предварительно в окне Обзор рынка скрыть этот символ с префиксом, то тестирование начинается с даты, заданной в настройках.

Не пойму, это баг или фича? : )