Новая версия платформы MetaTrader 5 build 1930: Плавающие окна графиков и .Net библиотеки в MQL5 - страница 88

 

I finally got it by appending line by line to a file in the Common folder:

double OnTester() {
   double dd = sqrt(TesterStatistics(STAT_BALANCE_DDREL_PERCENT)),
          oD = (TesterStatistics(STAT_BALANCE_DDREL_PERCENT)),
          d1 = TesterStatistics(STAT_BALANCEDD_PERCENT),
          d2 = TesterStatistics(STAT_BALANCE_DDREL_PERCENT),
          d3 = TesterStatistics(STAT_EQUITYDD_PERCENT),
          d4 = TesterStatistics(STAT_EQUITY_DDREL_PERCENT),
          pr = TesterStatistics(STAT_PROFIT);
   if (dd == 0.0) return(100.0*pr);
   
   string name ="";  // Public name/frame label
   ulong  pass =0;   // Number of the optimization pass at which the frame is added
   long   id   =0;   // Public id of the frame
   double val  =0.0; // Single numerical value of the frame
   double stat_values[];
   FrameNext(pass,name,id,val,stat_values);
    
   if ( true ) { // pass%1 == 0 ) { 
      addLineToFileCommon(StringFormat("pass: %i  %s  d1 %05.2f  d2 %05.2f  d3 %05.2f  d4 %05.2f  org DD%% %05.2f  sqrt(DD%%) %05.2f  Profit %07.2f  ret %07.2f\n", 
                     pass,TimeToString(TimeLocal(),TIME_SECONDS),(d1),(d2),(d3),(d4),(oD),(dd),(pr),(pr/dd)),
                    "StratTest.txt");
         
   }
   return ( pr/dd );
}

The percent values are provided from 0 to 100.

But pass is always 0 (?) and TimeLocal always 23:59:59:

pass: 0  23:59:59  d1 06.07  d2 06.23  d3 07.06  d4 07.06  org DD% 06.23  sqrt(DD%) 02.50  Profit 1887.75  ret 0756.32
pass: 0  23:59:59  d1 05.15  d2 05.15  d3 05.57  d4 05.57  org DD% 05.15  sqrt(DD%) 02.27  Profit 1834.59  ret 0808.75
pass: 0  23:59:59  d1 07.56  d2 07.56  d3 08.75  d4 08.75  org DD% 07.56  sqrt(DD%) 02.75  Profit 2517.04  ret 0915.20
pass: 0  23:59:59  d1 04.43  d2 04.43  d3 04.96  d4 05.00  org DD% 04.43  sqrt(DD%) 02.10  Profit 1269.95  ret 0603.46
pass: 0  23:59:59  d1 29.40  d2 29.40  d3 31.47  d4 31.47  org DD% 29.40  sqrt(DD%) 05.42  Profit 1681.97  ret 0310.20
pass: 0  23:59:59  d1 05.99  d2 05.99  d3 06.45  d4 06.45  org DD% 05.99  sqrt(DD%) 02.45  Profit 4818.85  ret 1968.58
pass: 0  23:59:59  d1 08.34  d2 10.58  d3 08.72  d4 11.26  org DD% 10.58  sqrt(DD%) 03.25  Profit 3601.66  ret 1107.45
pass: 0  23:59:59  d1 17.19  d2 17.19  d3 18.71  d4 18.71  org DD% 17.19  sqrt(DD%) 04.15  Profit 5000.31  ret 1206.16
pass: 0  23:59:59  d1 25.16  d2 25.16  d3 25.27  d4 25.27  org DD% 25.16  sqrt(DD%) 05.02  Profit 5833.76  ret 1163.09
pass: 0  23:59:59  d1 14.95  d2 14.95  d3 12.12  d4 14.91  org DD% 14.95  sqrt(DD%) 03.87  Profit 8916.67  ret 2305.88
pass: 0  23:59:59  d1 29.67  d2 29.67  d3 30.37  d4 30.37  org DD% 29.67  sqrt(DD%) 05.45  Profit 2715.90  ret 0498.64
pass: 0  23:59:59  d1 09.72  d2 11.26  d3 10.79  d4 12.31  org DD% 11.26  sqrt(DD%) 03.36  Profit 6876.42  ret 2049.58
pass: 0  23:59:59  d1 17.35  d2 17.35  d3 17.22  d4 17.22  org DD% 17.35  sqrt(DD%) 04.17  Profit 7261.55  ret 1743.23
pass: 0  23:59:59  d1 11.93  d2 11.93  d3 12.09  d4 12.09  org DD% 11.93  sqrt(DD%) 03.45  Profit 4979.16  ret 1441.58

This is the corresponding table of the optimization:


Interesting to see the table shows 15 lines my file only 14. The first entry is missing. But the counter shows 13:


The empty line of the table corresponds to this log-entry:

2018.12.20 17:24:24.531 Core 05 genetic pass (0, 2) tested with error "incorrect input parameters" in 0:00:00.250

And this shows that - I guess - the 'non-passes' due to "return(INIT_PARAMETERS_INCORRECT)" or "return(INIT_FAILED)" still is counted by the Tester and the genetic Algorithm:

2018.12.20 17:24:47.636    Tester    genetic optimization finished on pass 15 (of 1048576)
2018.12.20 17:24:47.636    Statistics    optimization done in 0 minutes 26 seconds
2018.12.20 17:24:47.638    Statistics    shortest pass 0:00:00.250, longest pass 0:00:23.120, average pass 0:00:10.869
2018.12.20 17:24:47.638    Statistics    local 15 tasks (100%), remote 0 tasks (0%), cloud 0 tasks (0%)
2018.12.20 17:24:47.654    Tester    15 new records saved to cache file 'tester\cache\NewEAb v003.EURUSD.H1.20170108.20171223.11.32E03FFA9573C89D9A9C8BF2DFA77676.opt'
 
Доступна бета 1966 билда
 
Carl Schreiber:

I finally got it by appending line by line to a file in the Common folder:

The percent values are provided from 0 to 100.

But pass is always 0 (?) and TimeLocal always 23:59:59:

Why do you use FrameNext in OnTester()? It should be called just in OnTesterPass.

Download source codes framegenerator.mqh and moving_average_with_frames.mq5 from the article https://www.mql5.com/ru/articles/403 and learn how to use it.

It is simple - just add two three lines into your EA code

#include <FrameGenerator.mqh>
//--- генератором фреймов
CFrameGenerator fg;

and 

//+------------------------------------------------------------------+
//| Tester function                                                  |
//+------------------------------------------------------------------+
double OnTester()
  {
//--- тут нужно вставить свою функцию для вычисления критерия оптимизации
   double TesterCritetia=MathAbs(TesterStatistics(STAT_SHARPE_RATIO)*TesterStatistics(STAT_PROFIT));
   TesterCritetia=TesterStatistics(STAT_PROFIT)>0?TesterCritetia:(-TesterCritetia);
//--- вызываем на каждом окончании тестирования и передаем в качестве параметра критерий оптимизации
   fg.OnTester(TesterCritetia);
//---
   return(TesterCritetia);
  }

and four functios

//+------------------------------------------------------------------+
//| TesterInit function                                              |
//+------------------------------------------------------------------+
void OnTesterInit()
  {
//--- подготавливаем график для отображения нескольких линий баланса
   fg.OnTesterInit(3); //параметр задает количество линий баланса на графике
  }
//+------------------------------------------------------------------+
//| TesterPass function                                              |
//+------------------------------------------------------------------+
void OnTesterPass()
  {
//--- обрабатываем полученные результаты тестирования и выводим графику
   fg.OnTesterPass();
  }
//+------------------------------------------------------------------+
//| TesterDeinit function                                            |
//+------------------------------------------------------------------+
void OnTesterDeinit()
  {
//--- завершение оптимизации
   fg.OnTesterDeinit();
  }
//+------------------------------------------------------------------+
//|  Обработка событий на графике                                    |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
//--- запускает воспроизведение фреймов по окончании оптимизации при нажатии на шапке
   fg.OnChartEvent(id,lparam,dparam,sparam,100); // 100 - это пауза в ms между кадрами
  }
Визуализируй стратегию в тестере MetaTrader 5
Визуализируй стратегию в тестере MetaTrader 5
  • www.mql5.com
Каждому из нас давно знакома поговорка "Лучше один раз увидеть, чем сто раз услышать". Вы можете прочитать десятки книг о Париже или Венеции, но мысленные образы не позволят вам испытать те же ощущения, как от прогулки по их вечерним улицам. Преимущество визуализации, или наглядного представления, может быть легко спроецировано на любой аспект...
 
Renat Fatkhullin:
Доступна бета 1966 билда

Изменений не заметил. Наверное, это хорошо.

 
Rashid Umarov :

Why do you use FrameNext in OnTester()? It should be called just in OnTesterPass.

Download source codes framegenerator.mqh and moving_average_with_frames.mq5 from the article https://www.mql5.com/ru/articles/403 and learn how to use it.

It is simple - just add two three lines into your EA code

and 

and four functios

Я действительно удивлен всей этой дискуссией на английском языке на этом форуме, о чем-то, что не по теме.

Разве это не тема о сообщениях об ошибках MT5? Каждый раз, когда я делаю это, мне приходится изо всех сил пытаться получить подтверждение получения, и если Metaquotes распознает и решит проблему. И теперь я могу прочитать все не по теме обсуждения о вещах, которые уже даны ответы на английском форуме.

Я всегда публикую серьезные, проверенные и подробные отчеты об ошибках / проблемах, и я хотел бы уделять такое же внимание моей тяжелой работе, что и Карл, которого он получил здесь о своей собственной заботе.

 
Carl Schreiber :

I finally got it by appending line by line to a file in the Common folder:

The percent values are provided from 0 to 100.

But pass is always 0 (?) and TimeLocal always 23:59:59:

This is the corresponding table of the optimization:


Interesting to see the table shows 15 lines my file only 14. The first entry is missing. But the counter shows 13:


The empty line of the table corresponds to this log-entry:

And this shows that - I guess - the 'non-passes' due to "return(INIT_PARAMETERS_INCORRECT)" or "return(INIT_FAILED)" still is counted by the Tester and the genetic Algorithm:

Вы должны использовать OnTesterInit (), OnTesterPass (), OnTesterDeinit (), и из этих функций вы можете распечатать их в журнале «Эксперты терминала». Посмотрите на английском форуме, там хотя бы одна ветка, где все продемонстрировано, как это работает.

In this case it should be mentioned in the reference as normally nobody would expect this - I guess.

В документации совершенно ясно, что STAT_BALANCE_DDREL_PERCENT представляет собой значение в процентах . Значение в процентах находится между 0 и 100 (в конечном счете выше 100), а не между 0 и 1. Возможно, перевод на немецкий язык не очень хорош (?).

Максимальная просадка баланса в процентах . В процессе торговли баланс может иметь многочисленные просадки, для каждой из которых рассчитывается относительная величина просадки в процентах. Наибольшее значение возвращается

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

 
Renat Fatkhullin :
Доступна бета 1966 билда
Не было 1964/1965 или я его пропустил?
 
Alain Verleyen:
Не было 1964/1965 или я его пропустил?

Билды не всегда идут по порядку

Builds don't always go in order.

 
Vladimir Pastushak :

Билды не всегда идут по порядку

Спасибо, просто хочу быть уверен.

 
Комментарии, не относящиеся к этой теме, были перенесены в "Вопросы от начинающих MQL5 MT5 MetaTrader 5".
Причина обращения: