Optimise an EA and get the best of the optimised ones. - page 41

 

Free signal - reoptimised.

There are currently 6 League TS running, which seem to me to be the most optimal ones.

The current results of the CU League favourites are on the previous pages.

Current TCs for over-optimisation:

Symbol System Reason
1 EURCHF ChnTrendDTS New
2 EURCHF ChnTrendSAR New
3 EURCHF ChnTrendSP New
4 EURCHF ChnFlatSP New
5 EURCHF ChnFlatSAR New
6 EURCHF ChnFlatRTS New
7 EURCHF ChnTrendRTS New
8 EURCHF ChnFlatDTS New
9 GBPUSD ChnTrendSAR Not allowed SL
10 CADJPY ChnFlatSAR Not allowed SL
11 CHFJPY EMAFlatRTS Big DD
12 USDJPY EMAFlatDTS Long Max Wait


I put USDJPY EMAFlatDTS

Optimization period 4.05.17 - 4.15.18, forward from 4.10.17

(As I over-optimise - I will correct this post, and re-optimise the TCs, starting with the last ones, to the first ones)

 
Georgiy Merts:

Free signal - reopened.

Currently there are 6 League TCs working there, which seem to me to be the most optimal.

Maybe you can still make it possible to write optimization results to the file? Just standard indicators do not give me, and I think others do not give much.

Here is my data set, which gives the optimizer, but I plan to expand it too.

 
Aleksey Vyazmikin:

Maybe you could still make it possible to write optimization results to a file? It's just that I, and I think others, don't get much out of the standard indicators.

Here is my set of data provided by the optimizer, but I plan to expand it too.


Of course, I have all this data inside my Expert Advisor. Do you suggest that after each pass I generate such a file and put it in the file area?

But I am sure that many people will look at it?


But, say, in your file - I personally do not perceive this figure - just "can not see the forest for the trees". I only look at the columns "Recovery Factor", and "Failure".

All other data is superfluous for me, they do not tell me anything new. I believe it is necessary to have as few parameters in experts as possible, and as few indicators for evaluation as possible. I would put everything into one parameter "quality", but I see that another parameter "sustainability" is needed.


You say "these are the parameters that I have output, and I intend to expand this set" - what is the goal?

Show me a more concrete example - where would you use at least one third of those columns, which you output? You're just like the participant of a neighboring topic, who wrote a wonderful canvas engine, which displays wonderful visual effects on the chart... But he didn't think about the practical use of these features. Obtaining any data should be of some particular use, should be a part of a particular methodology of selection or TC operation. And "just to have"... These resources are better spent on additional re-optimization of outsider systems or new systems.

In idea, of course, it is possible to bother with the output file. Well, if there will be at least a couple more votes that the three parameters - quality, drawdown and SL queue is not enough - well, make such a file, and will display its data in the reports.

 

Current TCs for over-optimisation:

Symbol System Reason
1 EURCHF ChnTrendSAR New
2 EURCHF ChnTrendSP New
3 EURCHF ChnFlatSP New
4 EURCHF ChnFlatSAR New
5 EURCHF ChnFlatRTS New
6 EURCHF ChnTrendRTS New
7 EURCHF ChnFlatDTS New
8 GBPUSD ChnTrendSAR Not allowed SL
9 EURCHF EMATrendSP Many SL
10 GBPAUD EMAFlatRTS Big DD
11 CADJPY ChnFlatSAR Not allowed SL
12 CHFJPY EMAFlatRTS Big DD
13 GBPNZD EMAFlatSAR Long Max Wait


I have a GBPNZD EMAFlatSAR

Period 5.05.17 - 5.05.18, forward from 5.10.17

 

Current situation on favourites

(All TCs work on demo without MM, with minimum lots)

Top 20 by quality:

Chart of the top 10 in terms of quality:

Best 20 by balance:

Best 10 chart by balance:

Just a reminder, the Trading Systems League Expert (versions for both MT4 and MT5) is on Yandex-disk. In the archive also attached a brief description of the principles of the League and a list of TS, working in it.

By default, the League works with one TS (EURUSD ChnTrendSAR, magik 220141) without any restrictions.

Other TS work only in the strategy tester. For their work on a demo or real account registration codes are required. Registration codes, valid for 3 months with a link to your account number, are issued for optimising individual League systems (2-5 hours on a quad-core Core i5).

EALeague
EALeague
  • yadi.sk
View and download from Yandex.Disk
 
Georgiy Merts:


Of course, I have all this data inside the Expert Advisor. Are you suggesting to generate such a file after each pass, and throw it into the file area?

But I'm sure that many people will look at it?

You say, "these are the parameters I display, and I still intend to expand this set" - what is the purpose?

Show me a more concrete example - where would you use at least a third of the columns you output?

In theory, of course, the output of the file is possible. Well, if there will be at least a couple more votes that the three parameters - quality, subsidence and SL queue is not enough - well, make such a file, and will display its data in the reports.

Let me put it this way: I was suddenly curious to see what kind of Expert Advisors I was optimizing, but not knowing their exact algorithm, I decided to focus on their performance and suddenly realized that I could not assess the results due to the paucity of statistical indicators.

You say that project participants should do the selection themselves, but this is not realistic based on the available data.

Now I am working on a mechanical evaluation system - the main idea is to balance all the indicators, not just their absolute value, which of course is just as important.

For example, I often use the formula "Income"-"Maximum Continuous Profit "*3-"Expense"-"Maximum Continuous Loss "*3 to estimate profits, and if we are still in the plus, we look further, but also at this stage we can sift out a lot.

And, the drawdown I only perceive in natural terms, as the percentage depends on the cumulative profits at the time of drawdown, but this can not say anything since there is no guarantee that the next time this drawdown will occur as well, only after the cumulative profits. For example, a drawdown of 10% with a start-up capital of 1000 is 10 units, and if 10% with a profit of 2000, it is already 30 units, agree that the figures are not comparable. The meaning of the percentage only if the withdrawal of funds each day, but if you implement it, then other indicators are creeping, which are automatically calculated, then you have to each figure by yourself, which is troublesome.

I can give you my code for writing data to a file, if you haven't done it before.

 
Aleksey Vyazmikin:

I can give you my code for writing data to a file, if you haven't done it before.

You shouldn't have given up Skype. You could have looked at the code and worked out the best way to do it.

Come on, what indicators do you need?

And at what point should it be output by the Expert Advisor? As I understand - in OnTester() function? I will make you such a feature. It will output a CSV-file, which can be easily opened in Excel.


And what Expert Advisor are we talking about, the main Expert Advisor of the League, or separate EAs for different TS?

 
Georgiy Merts:

You should not have given up Skype. You could have looked at the code and worked out how best to do it.

Come on, what indicators do you need?

And at what point should it be output by the Expert Advisor? As I understand - in the function OnTester ()? I will make you such a feature.


Oh, and what EA are we talking about here - the main Expert Advisor of the League, or separate EAs for different TS?

I have it organized like this

//--- Кол-во показателей для записи в файл
#define  STAT_VALUES_COUNT 21
double stat_values[STAT_VALUES_COUNT]; // Массив для показателей теста


//+------------------------------------------------------------------+
//| Начало оптимизации                                               |
//+------------------------------------------------------------------+
void OnTesterInit()
  {
      //FileWrite(Statistic,"typeMAH","pMAH","pipsXH","pMAT_Sell","CalcPlan","FinRezultatTotalSell","avrMassSell","MaxOrdersSell","N_Sell","ProcTotalSell","Вершин Sell","FinRezultatTotalBuy","avrMassBuy","MaxOrdersBuy","N_Buy","ProcTotalBuy","Вершин Buy");
      //Printer.Write("OnTesterInit");

      string TimeF=TimeToString(TimeLocal(),TIME_DATE|TIME_MINUTES);
      StringSetCharacter(TimeF,13,'_');    
      Statistic=Printer.FileCreate(Symbol()+"_"+TimeF+"_S&G","S&G\\Test",false,false,EvryTick); //Создание файла для записи     
      Printer.Write("N",
      "Депо",
      "Прибыль",
      "Доход",
      "Расход",
      "Прибыльность",
      "Фактор вост.",
      "Мат ож",
      "К.Ш.",
      "Макс ДД баланса",
      "Макс ДД средств",
      "N сделок",
      "N трейдов",
      "N + трейдов",
      "N - трейдов",
      "Sell трейдов",
      "Buy трейдов",
      "Sell + трейдов",
      "Buy + трейдов",
      "Avr + трейдов",
      "Avr - трейдов",
      "% Sell от прибыльных",
      "% Buy от прибыльных",
      "% Sell от всех",
      "% Buy от всех",      
      "% + от всех",
      "Custom"            
      );
  }
//+------------------------------------------------------------------+
//| Обработчик события окончания тестирования                        |
//+------------------------------------------------------------------+
double OnTester()
  {

  
      //--- Заполним массив показателями теста
      GetTestStatistics(stat_values);
      //--- Создадим фрейм
      FrameAdd("Statistics",1,0,stat_values);

   double custom_Pokazatel_01=CustomPokazatelf(1);

  // return(0.0);
   return(custom_Pokazatel_01);

  }
//+------------------------------------------------------------------+
//| Пользовательские функции                                         |
//+------------------------------------------------------------------+
double CustomPokazatelf(int VariantPokazatel)
{

     double  profit = TesterStatistics(STAT_PROFIT);
     double  max_dd = TesterStatistics(STAT_BALANCE_DD);
   //  double  RecoveryF = TesterStatistics(STAT_RECOVERY_FACTOR);  
     double  Mat_Ojidanie = TesterStatistics(STAT_EXPECTED_PAYOFF);  
     
   double custom_Pokazatel=0;
   //=ЕСЛИ(C3-40000>0;(C3-40000)*(3000-J3);-1)
   //if (profit-40000>0)custom_Pokazatel_01=(profit-40000)*(3000-max_dd);
   //=ЕСЛИ(И(C3-40000>0;3000-J3>0);(C3-40000)*СТЕПЕНЬ(3000-J3;1,5)*H3;0)

   if (VariantPokazatel==1)
      {
      if (profit-Find_Profit>0 && Find_MaxDD-max_dd>0)custom_Pokazatel=(profit-Find_Profit)*MathPow((Find_MaxDD-max_dd),1.5)*Mat_Ojidanie/(Find_Profit+max_dd);
      else custom_Pokazatel=-1;
      }
   return(custom_Pokazatel);
}
//+------------------------------------------------------------------+
//| Очередной проход оптимизации                                     |
//+------------------------------------------------------------------+
void OnTesterPass()
  {

      string name ="";  // Публичное имя/метка фрейма
      ulong  pass =0;   // Номер прохода в оптимизации, на котором добавлен фрейм
      long   id   =0;   // Публичный id фрейма
      double val  =0.0; // Одиночное числовое значение фрейма
      //---
      FrameNext(pass,name,id,val,stat_values);
      //---
     // Print(__FUNCTION__,"(): pass: "+IntegerToString(pass)+"; STAT_PROFIT: ",DoubleToString(stat_values[0],2));
     // double a=stat_values[0];
     // Print ("a=",a);
     // Print(DotToComma(DoubleToString(stat_values[0],2)));
      
      double SellPribl_from_Pribl=0.0;//Процент прибыльных позиций Sell из всех прибыльных
      double BuyPribl_from_Pribl=0.0;//Процент прибыльных позиций Buy из всех прибыльных
      double SellPribl_from_All=0.0;//Процент прибыльных позиций Sell из всех проторгованных
      double BuyPribl_from_All=0.0;//Процент прибыльных позиций Buy из всех проторгованных
      double Pribl_from_All=0.0;//Процент прибыльных позиций из всех проторгованных
      if (stat_values[12]>0) SellPribl_from_Pribl=stat_values[16]/stat_values[12]*100.0;
      if (stat_values[12]>0) BuyPribl_from_Pribl=stat_values[17]/stat_values[12]*100.0;
      if (stat_values[11]>0) SellPribl_from_All=stat_values[16]/stat_values[11]*100.0;
      if (stat_values[11]>0) BuyPribl_from_All=stat_values[17]/stat_values[11]*100.0;
      if (stat_values[11]>0) Pribl_from_All=stat_values[12]/stat_values[11]*100.0;
      
      /*if (pass>0)*/ Printer.Write(IntegerToString(pass),
                              stat_values[0],
                              stat_values[1],
                              stat_values[2],
                              stat_values[3],
                              DoubleToString(stat_values[4],2),
                              DoubleToString(stat_values[5],2),
                              DoubleToString(stat_values[6],2),
                              DoubleToString(stat_values[7],2),
                              stat_values[8],
                              stat_values[9],
                              stat_values[10],
                              stat_values[11],
                              stat_values[12],
                              stat_values[13],
                              stat_values[14],
                              stat_values[15],
                              stat_values[16],
                              stat_values[17],
                              stat_values[18],
                              stat_values[19],      
                              DoubleToString(SellPribl_from_Pribl,2),
                              DoubleToString(BuyPribl_from_Pribl,2),  
                              DoubleToString(SellPribl_from_All,2),
                              DoubleToString(BuyPribl_from_All,2),
                              DoubleToString(Pribl_from_All,2),
                              DoubleToString(stat_values[20],2)
                              );


//--- Если включена запись результатов оптимизации
//      CreateOptimizationReport();

/*

  Print("OnTesterPass");
         Printer.Write("OnTesterPass");
*/

  }
//+------------------------------------------------------------------+
//| Завершение оптимизации                                           |
//+------------------------------------------------------------------+
void OnTesterDeinit()
  {



      FileClose(Statistic);

  }
//+------------------------------------------------------------------+
//| Заполняет массив результатами теста                              |
//+------------------------------------------------------------------+
void GetTestStatistics(double &stat_array[])
  {


stat_array[0]=     TesterStatistics(STAT_INITIAL_DEPOSIT);      //      Значение начального депозита
stat_array[1]=     TesterStatistics(STAT_PROFIT);                //     Чистая прибыль по окончании тестирования, сумма STAT_GROSS_PROFIT и STAT_GROSS_LOSS (STAT_GROSS_LOSS всегда меньше или равно нулю)
stat_array[2]=     TesterStatistics(STAT_GROSS_PROFIT);    //   Общая прибыль, сумма всех прибыльных (положительных) трейдов. Значение больше или равно нулю
stat_array[3]=     TesterStatistics(STAT_GROSS_LOSS);         //        Общий убыток, сумма всех убыточных (отрицательных) трейдов. Значение меньше или равно нулю
stat_array[4]=     TesterStatistics(STAT_PROFIT_FACTOR);           //   Прибыльность – отношение STAT_GROSS_PROFIT/STAT_GROSS_LOSS. Если STAT_GROSS_LOSS=0, то прибыльность принимает значение DBL_MAX
stat_array[5]=     TesterStatistics(STAT_RECOVERY_FACTOR);      //      Фактор восстановления – отношение STAT_PROFIT/STAT_BALANCE_DD
stat_array[6]=     TesterStatistics(STAT_EXPECTED_PAYOFF);      //      Математическое ожидание выигрыша
stat_array[7]=     TesterStatistics(STAT_SHARPE_RATIO);    //   Коэффициент Шарпа
stat_array[8]=     TesterStatistics(STAT_BALANCE_DD);         //        Максимальная просадка баланса в деньгах. В процессе торговли баланс может испытать множество просадок, берется наибольшее значение.
stat_array[9]=     TesterStatistics(STAT_EQUITY_DD);          //        Максимальная просадка средств в деньгах. В процессе торговли средства могут испытать множество просадок, берется наибольшее значение.
stat_array[10]= TesterStatistics(STAT_DEALS);               //  Количество совершенных сделок
stat_array[11]= TesterStatistics(STAT_TRADES);           //     Количество трейдов
stat_array[12]= TesterStatistics(STAT_PROFIT_TRADES);      //   Прибыльные трейды
stat_array[13]= TesterStatistics(STAT_LOSS_TRADES);           //        Убыточные трейды
stat_array[14]= TesterStatistics(STAT_SHORT_TRADES);       //   Короткие трейды
stat_array[15]= TesterStatistics(STAT_LONG_TRADES);              //     Длинные трейды 
stat_array[16]= TesterStatistics(STAT_PROFIT_SHORTTRADES);   // Короткие прибыльные трейды
stat_array[17]= TesterStatistics(STAT_PROFIT_LONGTRADES);          //   Длинные прибыльные трейды
stat_array[18]= TesterStatistics(STAT_PROFITTRADES_AVGCON);  // Средняя длина прибыльной серии трейдов
stat_array[19]= TesterStatistics(STAT_LOSSTRADES_AVGCON);          //   Средняя длина убыточной серии трейдов
//stat_array[20]=       TesterStatistics(STAT_CUSTOM_ONTESTER);    //   Custom
stat_array[20]= CustomPokazatelf(1);       //   Custom

  }

There is a glitch in the code, or maybe not in the code - sometimes the last frame does not come of all, but it's not always, and sometimes the numbering can coincide. In general, I think this is a program glitch, but if you see a bug in the code, tell me!


And in which EAs - yes, you can, and in all that are subject to optimization.

 

Hmmm...

Do you save each test run not only in the statistics file, but also in the frames of the MQD file? Did I get it right ?

Also - I wonder how such output to a file will work on OnTesterPass(), if tester's pass is in Cloud? In a frame it will be written, but in a file, I suspect, not.

Alexey, you will drown in the data stream.


But, if it is so important for you - I can put your code in TC League.

Your code is quite transparent and clever, so it will fit almost without changes, I'll just need some slight modification, so that all structures are inside my OOP-classes.

Well... I'll do it, today or tomorrow I'll put your code in the League... I don't see how that's much use, though. There's a lot of numbers, and we can't see the forest for the trees.

 
Georgiy Merts:

Hmmm...

Do you save each test run not only in the statistics file, but also in the frames of the MQD file? Did I get it right ?

Alexey, you will drown in the data stream.


But, if it is so important for you - I can put your code in TC League.

Your code is quite transparent and smart, so it will fit almost without changes, I'll just need some fine-tuning, so that all structures are inside my OOP-classes.

Well... I'll do it, today or tomorrow I'll put your code in the League... I don't see much use in it, though. There's a lot of numbers, and we can't see the forest for the trees.

Frames are needed to make it all gather from the network - optimizers (agents), I'm not using one computer. And so the code is not mine from scratch - I partially gutted it from the article about optimization and adapted it to my needs.

In Expert Advisor, you can make an external variable, according to which statistics will be written or not.

And, you have few external variables in your EA, unlike my monster, so you can (need to) write the value of variables at once - it will add a few lines in the final file, but will allow to work with it on a different level. Now I'm just adding these values to the file by hand, i.e. I'm optimizing in fragments.