MetaTrader 5 Strategy Tester: bugs, bugs, suggestions for improvement - page 27

 
fxsaber:
Probably missed it.

They didn't miss it.

The current format of the opt file does not allow it. You have to think about it.

 
Slava:

They didn't miss it.

The current format of opt-file doesn't allow. You have to think about it.

Doesn't seem to need to change anything.

Forum on trading, automated trading systems and strategy testing

Bugs, bugs, questions

Slava, 2019.04.19 15:11

//+------------------------------------------------------------------+
//| входные параметры тестирования                                   |
//+------------------------------------------------------------------+
struct TestCacheInput
  {
   wchar_t           name[64];
   int               flag;                    // оптимизируемый параметр
   int               type;                    // тип TYPE_XXX
   int               digits;                  // количество знаков после запятой
   int               offset;                  // смещение в буфере параметров
   int               size;                    // размер значения параметра в буфере
   //--- 0-start,1-step,2-stop
   union { INT64 integers[3]; double numbers[3]; };
  };
   m_header.header_size=sizeof(TestCacheHeader)+m_inputs.Total()*sizeof(TestCacheInput)+m_header.parameters_size;
//--- кешируемая запись содержит номер прохода (при генетике - номер по порядку), структуру результатов тестирования (если математика, то 1 double), буфер оптимизируемых параметров и генетический проход

Each input is defined by a structure with the required fields.

 

It is now very easy to find out

  • All tester settings and EA input parameters.
  • All statistical data of each pass of Optimisation.


But we can't find out, for example, statistical data of a single pass. It is clear, there is a tst-format. But it would be convenient to use CTRL+C in the Strategy Tester to form a set-file with statistical data in the Backtest tab.

Forum on trading, automated trading systems and strategy testing

Libraries: TesterCache

fxsaber, 2019.11.11 04:45

; saved on 2019.11.13 19:40:01
; Experts\Examples\MACD\MACD Sample LImitTP.ex5
; EURUSD
; 2019.09.01 - 2019.11.13
;
InpLots=0.1
InpTakeProfit=200||10||5||500||Y
InpTrailingStop=290||30||10||300||Y
InpMACDOpenLevel=5||5||5||200||Y
InpMACDCloseLevel=180||5||5||200||Y
InpMATrendPeriod=8||1||1||200||Y
;
; initial_deposit = 10000.0
; withdrawal = 0.0
; profit = 479.15
; grossprofit = 479.15
; grossloss = 0.0
; maxprofit = 99.8
; minprofit = 0.0
; conprofitmax = 479.15
; maxconprofit = 479.15
; conlossmax = 0.0
; maxconloss = 0.0
; balance_min = 10000.0
; maxdrawdown = 0.0
; drawdownpercent = 0.0
; reldrawdown = 0.0
; reldrawdownpercent = 0.0
; equity_min = 9997.700000000001
; maxdrawdown_e = 253.6000000000004
; drawdownpercent_e = 2.457388152985982
; reldrawdown_e = 253.6000000000004
; reldrawdownpercnt_e = 2.457388152985982
; expected_payoff = 47.91500000000001
; profit_factor = 1.797693134862316 e+308
; recovery_factor = 1.889392744479493
; sharpe_ratio = 1.069726339729858
; margin_level = 1.797693134862316 e+308
; custom_fitness = 0.0
; deals = 15
; trades = 10
; profittrades = 10
; losstrades = 0
; shorttrades = 6
; longtrades = 4
; winshorttrades = 6
; winlongtrades = 4
; conprofitmax_trades = 10
; maxconprofit_trades = 10
; conlossmax_trades = 0
; maxconloss_trades = 0
; avgconwinners = 10
; avgconloosers = 0

I don't know about others, but I find it convenient when the set file contains all the information. It's very quick to figure out what it is, where it comes from and how much.


This is the output of the ExpTradeSummary structure fields.

Forum on trading, automated trading systems and trading strategies testing

Bugs, bugs, questions

Slava, 2019.04.19 15:11

//+------------------------------------------------------------------+
//| Структура для статистики торговли                                |
//+------------------------------------------------------------------+
struct ExpTradeSummary;

#define  TOSTRING(A) #A + " = " + (string)(A) + "\n"

  string ToString( void ) const
  {
    return(
      TOSTRING(initial_deposit) +      // начальный депозит
      TOSTRING(withdrawal) +           // снято средств
      TOSTRING(profit) +               // общая прибыль (+)
      TOSTRING(grossprofit) +          // общий плюс
      TOSTRING(grossloss) +            // общий минус
      TOSTRING(maxprofit) +            // максимально прибыльная сделка
      TOSTRING(minprofit) +            // максимально убыточная сделка
      TOSTRING(conprofitmax) +         // прибыль максимальной последовательности прибыльных сделок
      TOSTRING(maxconprofit) +         // максимальная прибыль среди последовательностей
      TOSTRING(conlossmax) +           // убыток максимальной последовательности убыточных сделок
      TOSTRING(maxconloss) +           // максимальный убыток среди последовательностей
      TOSTRING(balance_min) +          // минимальное значение баланса (для расчёта абсолютной просадки)
      TOSTRING(maxdrawdown) +          // максимальная просадка по балансу
      TOSTRING(drawdownpercent) +      // отношение максимальной просадки по балансу к её пику
      TOSTRING(reldrawdown) +          // максимальная относительная просадка по балансу в деньгах
      TOSTRING(reldrawdownpercent) +   // максимальная относительная просадка по балансу в процентах
      TOSTRING(equity_min) +           // минимальное значение equity (для расчёта абсолютной просадки по equity)
      TOSTRING(maxdrawdown_e) +        // максимальная просадка по equity
      TOSTRING(drawdownpercent_e) +    // отношение максимальной просадки по equity к её пику (+)
      TOSTRING(reldrawdown_e) +        // максимальная относительная просадка по equity в деньгах
      TOSTRING(reldrawdownpercnt_e) +  // максимальная относительная просадка по equity в процентах
      TOSTRING(expected_payoff) +      // матожидание выигрыша (+)
      TOSTRING(profit_factor) +        // показатель прибыльности (+)
      TOSTRING(recovery_factor) +      // фактор восстановления (+)
      TOSTRING(sharpe_ratio) +         // коэффициент Шарпа (+)
      TOSTRING(margin_level) +         // минимальный уровень маржи
      TOSTRING(custom_fitness) +       // пользовательский фитнесс - результат OnTester (+)
      TOSTRING(deals) +                // общее количество сделок
      TOSTRING(trades) +               // количество сделок out/inout
      TOSTRING(profittrades) +         // количество прибыльных
      TOSTRING(losstrades) +           // количество убыточных
      TOSTRING(shorttrades) +          // количество шортов
      TOSTRING(longtrades) +           // количество лонгов
      TOSTRING(winshorttrades) +       // количество прибыльных шортов
      TOSTRING(winlongtrades) +        // количество прибыльных лонгов
      TOSTRING(conprofitmax_trades) +  // максимальная последовательность прибыльных сделок
      TOSTRING(maxconprofit_trades) +  // последовательность максимальной прибыли
      TOSTRING(conlossmax_trades) +    // максимальная последовательность убыточных сделок
      TOSTRING(maxconloss_trades) +    // последовательность максимального убытка
      TOSTRING(avgconwinners) +        // среднее количество последовательных прибыльных сделок
      TOSTRING(avgconloosers)          // среднее количество последовательных убыточных сделок
    );
 

Since powerful caches have appeared, it is advisable to improve them somewhat.

Now only one user parameter, OnTester, gets into the cache.


It would be very convenient if ExpTradeSummary became three or five doubles bigger. Which could be filled in via

double OnTester( double &CustomDoubles[] );


Now you analyze caches and obviously lack possibility to see not one user's value but several.

 

This is a request to Metaquotes, I hope that at least one developer of the team can answer (sorry if he was already asked, but due to language problem I can't find answer on Russian forum).

Is it reasonable to ask for an improvement of the Strategy Tester to add the ability to test a trading situation that never happens on a demo account, but only on a real account? As it is really hard to create robust code without being able to fully test it.

This is mainly because of the centralized market (as opposed to Forex / CFD). For example, partial order filling, on a demo account this never happens (as far as I know), but on a real account on futures or equities it's a common situation. It would be very useful to have a tool to simulate such a situation.

Partial fill is just an example, if Metaquotes thinks it's a good idea to work with such features, I'm willing to centralise the ideas and provide a detailed description of such features. (Nothing specific for my own needs).

Thanks for your time and answer(s).

 
Alain Verleyen:

it is difficult to create reliable code without being able to fully test it.

To do this, every serious EA developer debugs their trading libraries for years on real accounts.

There is no way to create reliable code without it.

 
fxsaber:

To do this, every serious EA developer debugs their trading libraries for years on real accounts.

There is no way to create reliable code without it.

That's true, but it would help to avoid a lot of time-consuming tests on a real account.

 
Artyom Trishkin:

So it is true, but this functionality would help to avoid many time-consuming tests on a real account.

There are two objectives.

  1. An adequate trading biobioteque that just knows how to show the current trading status, trading history and send orders. Here the Tester is almost no help. The demo can help a lot if we conduct stress tests. We cannot do them on the real account - it's expensive. Therefore, there is only a demo on a huge number of symbols/servers. Such libraries are on the fingers of one hand.
  2. Practicing the trading logic of partial executions, redirects, etc. This point is much easier than the first one. And repeatedly solved on the same MT4 without any testers. It really is simple.

A tester can only help with the second point, the simple one. You can implement partial execution by measuring the allegedly "liquidity ceiling" of the TS. But that would be an extremely crude estimate.


It should be understood that any enhancements in the Tester are additional brakes even if these enhancements are not used.

 
fxsaber :

To do this, every serious EA developer debugs their trading libraries for years on real accounts.

There is no way to create reliable code without it.

I would advise you to forget me once and for all with your useless and arrogant posts.

Unfortunately, I have no way of filtering them out.

Never reply to my post, please, you are wasting my time because of the notifications.

 
Alain Verleyen:

I would advise you to forget me once and for all with your useless and arrogant posts.

I recommend you to start questioning the adequacy of the automatic Russian translators you use.


Unfortunately I have no way to filter them out.

Never reply to my post, please, you are wasting my time because of the notifications.

OK.

Reason: