Libraries: SingleTesterCache - page 3

 

2 issue.

Print(SingleTesterCache.Summary.ToString()) command;

I tested it in other Expert Advisors etc. and it gives out some wrong statistics.

variant 1

LO      0       23:58:34.935    Core 1  2020.12.29 23:59:59   bars = 0
FF      0       23:58:34.935    Core 1  2020.12.29 23:59:59   ticks = 0
JP      0       23:58:34.935    Core 1  2020.12.29 23:59:59   symbol =  
CE      0       23:58:34.935    Core 1  2020.12.29 23:59:59   initial_deposit = 0.0
EP      0       23:58:34.935    Core 1  2020.12.29 23:59:59   withdrawal = 0.0
HH      0       23:58:34.935    Core 1  2020.12.29 23:59:59   profit = 0.0
HN      0       23:58:34.935    Core 1  2020.12.29 23:59:59   grossprofit = 0.0
GG      0       23:58:34.935    Core 1  2020.12.29 23:59:59   grossloss = 0.0
RN      0       23:58:34.935    Core 1  2020.12.29 23:59:59   maxprofit = 0.0
HH      0       23:58:34.935    Core 1  2020.12.29 23:59:59   minprofit = 2.121995791459338 e-314
RO      0       23:58:34.935    Core 1  2020.12.29 23:59:59   conprofitmax = 1.22485
IK      0       23:58:34.935    Core 1  2020.12.29 23:59:59   maxconprofit = 2.659058588082234 e-312
CD      0       23:58:34.935    Core 1  2020.12.29 23:59:59   conlossmax = 6.951846319652696 e-310
CP      0       23:58:34.935    Core 1  2020.12.29 23:59:59   maxconloss = 0.0
FK      0       23:58:34.935    Core 1  2020.12.29 23:59:59   balance_min = 1.778636325028488 e-322
OM      0       23:58:34.935    Core 1  2020.12.29 23:59:59   maxdrawdown = 6.951582466168817 e-310
OS      0       23:58:34.935    Core 1  2020.12.29 23:59:59   drawdownpercent = 6.951844503800728 e-310
CH      0       23:58:34.935    Core 1  2020.12.29 23:59:59   reldrawdown = 3.458459520888726 e-323
NS      0       23:58:34.935    Core 1  2020.12.29 23:59:59   reldrawdownpercent = -nan
RI      0       23:58:34.935    Core 1  2020.12.29 23:59:59   equity_min = 4.120368567481494 e-310
NE      0       23:58:34.935    Core 1  2020.12.29 23:59:59   maxdrawdown_e = 0.0
OM      0       23:58:34.935    Core 1  2020.12.29 23:59:59   drawdownpercent_e = 0.0
PK      0       23:58:34.935    Core 1  2020.12.29 23:59:59   reldrawdown_e = 2.659058580572436 e-312
GO      0       23:58:34.935    Core 1  2020.12.29 23:59:59   reldrawdownpercnt_e = 4.450572116172598 e-308
GS      0       23:58:34.935    Core 1  2020.12.29 23:59:59   expected_payoff = 9.758620965830218 e-312
DD      0       23:58:34.935    Core 1  2020.12.29 23:59:59   profit_factor = 6.641883604895093 e-310
IG      0       23:58:34.935    Core 1  2020.12.29 23:59:59   recovery_factor = 0.0
CQ      0       23:58:34.935    Core 1  2020.12.29 23:59:59   sharpe_ratio = 0.0
CF      0       23:58:34.935    Core 1  2020.12.29 23:59:59   margin_level = -nan
MO      0       23:58:34.935    Core 1  2020.12.29 23:59:59   custom_fitness = 1.778636325028488 e-322
RI      0       23:58:34.935    Core 1  2020.12.29 23:59:59   deals = -1533096544
GO      0       23:58:34.935    Core 1  2020.12.29 23:59:59   trades = 32759
HF      0       23:58:34.935    Core 1  2020.12.29 23:59:59   profittrades = 16383
HO      0       23:58:34.935    Core 1  2020.12.29 23:59:59   losstrades = 0
MJ      0       23:58:34.935    Core 1  2020.12.29 23:59:59   shorttrades = -1
CM      0       23:58:34.935    Core 1  2020.12.29 23:59:59   longtrades = -1
KE      0       23:58:34.935    Core 1  2020.12.29 23:59:59   winshorttrades = -1
KQ      0       23:58:34.935    Core 1  2020.12.29 23:59:59   winlongtrades = -1
QH      0       23:58:34.935    Core 1  2020.12.29 23:59:59   conprofitmax_trades = -1534783007
PF      0       23:58:34.935    Core 1  2020.12.29 23:59:59   maxconprofit_trades = 32759
ML      0       23:58:34.935    Core 1  2020.12.29 23:59:59   conlossmax_trades = 0
IE      0       23:58:34.935    Core 1  2020.12.29 23:59:59   maxconloss_trades = 0
HQ      0       23:58:34.935    Core 1  2020.12.29 23:59:59   avgconwinners = 0
CI      0       23:58:34.935    Core 1  2020.12.29 23:59:59   avgconloosers = 0
QQ      0       23:58:34.935    Core 1  2020.12.29 23:59:59   ghpr = 6.951582202014298 e-310
HD      0       23:58:34.935    Core 1  2020.12.29 23:59:59   ghprpercent = 8.082419900316952 e-320
LE      0       23:58:34.935    Core 1  2020.12.29 23:59:59   ahpr = 6.951582466171288 e-310
GP      0       23:58:34.935    Core 1  2020.12.29 23:59:59   ahprpercent = 2.470328229206233 e-323
II      0       23:58:34.935    Core 1  2020.12.29 23:59:59   zscore = 6.951582382832739 e-310
QS      0       23:58:34.935    Core 1  2020.12.29 23:59:59   zscorepercent = 0.0
PD      0       23:58:34.935    Core 1  2020.12.29 23:59:59   lrcorr = 0.0
CR      0       23:58:34.935    Core 1  2020.12.29 23:59:59   lrstderror = 3.162020133383978 e-322
GM      0       23:58:34.935    Core 1  2020.12.29 23:59:59   symbols = 391475719
RG      0       23:58:34.935    Core 1  2020.12.29 23:59:59   corr_prf_mfe = 2.659058588536774 e-312
FP      0       23:58:34.935    Core 1  2020.12.29 23:59:59   corr_prf_mae = 6.951582431904475 e-310
LJ      0       23:58:34.935    Core 1  2020.12.29 23:59:59   corr_mfe_mae = 1.934147039389014 e-315
RJ      0       23:58:34.935    Core 1  2020.12.29 23:59:59   mfe_a = 6.951582173927753 e-310
KS      0       23:58:34.935    Core 1  2020.12.29 23:59:59   mfe_b = 0.0
ID      0       23:58:34.935    Core 1  2020.12.29 23:59:59   mae_a = 8.538950297007383 e-300
LR      0       23:58:34.935    Core 1  2020.12.29 23:59:59   mae_b = 0.0
ND      0       23:58:34.935    Core 1  2020.12.29 23:59:59   holding_time_min = 00:00:00
PN      0       23:58:34.935    Core 1  2020.12.29 23:59:59   holding_time_max = 00:00:00
GQ      0       23:58:34.935    Core 1  2020.12.29 23:59:59   holding_time_avr = 00:00:00

option 2

2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   bars = -1
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   ticks = 0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   symbol = 䆇樇翷
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   initial_deposit = 6.951844503800728 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   withdrawal = 3.458459520888726 e-323
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   profit = -nan
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   grossprofit = 9.568778329205075 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   grossloss = 0.0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   maxprofit = 0.0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   minprofit = 3.864959344282877 e-312
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   conprofitmax = 3.862032339566677 e-312
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   maxconprofit = 1.075317587769853 e-311
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   conlossmax = 9.05495701890495 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   maxconloss = 0.0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   balance_min = 0.0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   maxdrawdown = -nan
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   drawdownpercent = 1.778636325028488 e-322
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   reldrawdown = 6.951533981725193 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   reldrawdownpercent = 1.335089302104764 e-307
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   equity_min = -nan
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   maxdrawdown_e = -nan
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   drawdownpercent_e = 6.951533898402849 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   reldrawdown_e = 1.073729870228428 e-311
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   reldrawdownpercnt_e = 0.0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   expected_payoff = 0.0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   profit_factor = 3.864959344915281 e-312
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   recovery_factor = 9.881312916824931 e-324
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   sharpe_ratio = 3.864959351792675 e-312
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   margin_level = 9.054957018885978 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   custom_fitness = 3.864959359539624 e-312
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   deals = 1780533352
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   trades = 32759
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   profittrades = 1772945315
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   losstrades = 32759
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   shorttrades = 1780534738
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   longtrades = 32759
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   winshorttrades = 1775188141
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   winlongtrades = 32759
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   conprofitmax_trades = 16359
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   maxconprofit_trades = 0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   conlossmax_trades = 1780534738
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   maxconloss_trades = 32759
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   avgconwinners = 5
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   avgconloosers = 0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   ghpr = 4.940656458412465 e-324
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   ghprpercent = 3.864959353571311 e-312
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   ahpr = 9.881312916824931 e-324
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   ahprpercent = 6.951446327825149 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   zscore = 3.864959353373685 e-312
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   zscorepercent = 0.0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   lrcorr = 3.864959358946745 e-312
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   lrstderror = 2.816174181295105 e-322
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   symbols = 592434208
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   corr_prf_mfe = 6.951533946411159 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   corr_prf_mae = 0.0
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   corr_mfe_mae = 6.951533898778685 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   mfe_a = 3.864959353373685 e-312
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   mfe_b = 6.951533898682886 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   mae_a = 3.864959352978432 e-312
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   mae_b = 6.951533900420317 e-310
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   holding_time_min = 721296048 d 
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   holding_time_max = 1758699664 d 
2021.01.01 02:30:57.588 Core 1 2020.12.30 23:59:59   holding_time_avr = -22966109 d 

 
Aleksei Skrypnev:

2 problem.

Forum on trading, automated trading systems and testing trading strategies

Errors, bugs, questions

Renat Fatkhullin, 2021.01.01 00:14

If you have evidence, you should provide it in a fully consistent and technically reproducible form.
 
fxsaber:

Perhaps I assume that it does not work because of the reason of incorrect code transfer from the script to the Expert Advisor.

I will send you an example.

Procedure.

1. Any Expert Advisor is taken - I have tested repeatedly on the standard Movin' Averag.

2. I put inclusions at the top:

 #include <fxsaber\SingleTesterCache\SingleTesterCache.mqh>
 #include <fxsaber\SingleTesterCache\ExpTradeSummarySingle.mqh> 
  #include <fxsaber\MultiTester\MTTester.mqh> 

3. In OnDeinit I insert this from the 2nd script from here: https://www.mql5.com/ru/code/27611:

  uchar Bytes2[];
  
  if (MTTESTER::GetLastTstCache(Bytes2) != -1) // If it was possible to read the last cache record of a single run
  {
    const SINGLETESTERCACHE SingleTesterCache(Bytes2); // Drive it into the corresponding object.

    SingleTesterCache.SaveSet(NULL, true, "Created by " + __FILE__); // Save the set file with details.
    
    double Balance[];
    double Equity[];
  
      
    Print(SingleTesterCache.Header.ToString());  // Output the header of a single pass.
    Print(SingleTesterCache.Summary.ToString()); // Statistica.
    Print(SingleTesterCache.Inputs);             // Input parameters.

3.2 I tried the same "sort of" in this form

 const SINGLETESTERCACHE SingleTesterCache; // Загоняем ее в соответствующий объект.
            
            double Balance[];
    double Equity[];
            
               Print(SingleTesterCache.Header.ToString());  // Вывели заголовок одиночного прохода.
  Print(SingleTesterCache.Summary.ToString()); // Статистику.
      Print(SingleTesterCache.Summary.ToString()); // Статистику.
    Print(SingleTesterCache.Inputs);             // Входные параметры. 
 
Aleksei Skrypnev:

Perhaps I assume that it does not work because of the reason of incorrect code transfer from the script to the Expert Advisor.

I will send an example now.

It would be better with ready files. I don't understand what you need to get.

 
fxsaber:

I'd rather have the files ready to go. And I don't understand what you need to get.

Yes, I wanted to get the statistics of the last single run and write it to a file, for example, as you wrote here in the multitester topic. https://www.mql5.com/ru/forum/318305/page23#comment_19934192.

To do without inserting code in OnDeinit EA everywhere.

In fact, not even all statistics are needed, but a few parameters. For example, MQLInfoString(MQL_PROGRAM_NAME),TesterStatistics(STAT_SHARPE_RATIO).

Библиотеки: MultiTester
Библиотеки: MultiTester
  • 2020.11.26
  • www.mql5.com
Статьи и техническая библиотека по автоматическому трейдингу: Библиотеки: MultiTester
 
Aleksei Skrypnev:

Yes, I wanted to pull out the statistics of the last single run and write it to a file, for example, as you wrote here in the multitester topic. https://www.mql5.com/ru/forum/318305/page23#comment_19934192

To avoid inserting code in OnDeinit EA everywhere.

In fact, not even all statistics are needed, but a few parameters. For example, MQLInfoString(MQL_PROGRAM_NAME),TesterStatistics(STAT_SHARPE_RATIO).

Probably, you can try to run examples from the delivery or discussions.

 
fxsaber:

I guess you could try running the examples from the delivery or discussions.

I haven't found such functionality or something similar to record pass statistics in csv file yet. Hmm, even in libraries I have not found suitable functions. I will look for more.

I see such a block, but how to call the necessary information from it I did not understand

string ToString( void ) const

{

return(this.Header.expert_path[] + "\n; " +

this.Header.symbol[] + "\n; " +

::TimeToString(this.Header.date_from, TIME_DATE) + " - " + ::TimeToString(this.Header.date_to, TIME_DATE) + "\n; " +

::DoubleToString(this.Summary.TesterStatistics(STAT_PROFIT), 0) + ", " + " +

::DoubleToString(this.Summary.TesterStatistics(STAT_TRADES), 0) + ", " + ::DoubleToString(this.Summary.TesterStatistics(STAT_TRADES), 0) + ", " +

::DoubleToString(this.Summary.TesterStatistics(STAT_PROFIT_FACTOR), 2) + ", " + ::DoubleToString(this.Summary.TesterStatistics(STAT_PROFIT_FACTOR), 2) + ", " +

::DoubleToString(this.Summary.TesterStatistics(STAT_EXPECTED_PAYOFF), 2) + ", -" + ::DoubleToString(this.Summary.TesterStatistics(STAT_EXPECTED_PAYOFF), 2) + ", -" +

::DoubleToString(this.Summary.TesterStatistics(STAT_EQUITY_DD), 2));

}

 
Aleksei Skrypnev:

I see such a block, but I don't understand how to call the required information from it

Every time I look at my code as if it were someone else's, I just don't remember it at all.

That's why I can't give you a hint.

 
fxsaber:

Every time I look at my code as if it were someone else's - I stupidly don't remember it at all.

That's why I can't tell you.

I see, so the more you study, the more you understand. It's just that as I understand, not all functionality can be included in the current version of the library, that is, something may be missing to fulfil the task. The main thing is to understand whether it is possible or not)

 
Aleksei Skrypnev:

The main thing is to understand whether it's possible or not)

https://www.mql5.com/ru/code/viewcode/27611/229701/exptradesummarysingle.mqh