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

 
2314. The commission in percents per trade mode is not calculated correctly. + cannot be set further than the second decimal point via the GUI (it can be done via a file).
 

Forum on trading, automated trading systems and testing trading strategies

Expert Advisors: Validate

fxsaber, 2020.02.06 17:20

SZZY Unfortunately, MT5-Tester itself does not allow to prescribe custom Optimization criterion (not selection) outside of the EA source code. Although there are no architectural obstacles to do so.

Now you can select any pass from the Optimization results based on your criterion of choosing the best one.

But it's impossible to set your own Optimization criterion if there is only EX5. From my point of view, such an Optimization criterion could be set as an EA where only OnTester and TesterStatistics data are available. Most likely, there is no such thing in the developers' plans. Therefore, only a sounding out.

 

Sorry about this being machine translated to Russion from English, but I only found this thread, to report bugs.

There seems to be a problem with the Metatrader 5 platform when I start a debugging visual test in the editor and reach a breakpoint and press Ctrl + F.

Indicators (all, even enabled) redraw / shift 1 bar when pressing ctrl + f while debugging historical data)

Playback:

  1. Open Metatrader 5.
  2. Add EMA 5 and EMA 10 (built-in)
  3. Set Strategytester to Daily, Simulation: ticks or Real ticks (both cause the same problem)
  4. Open the Metatrader 5 editor
  5. Open the included ExpertMACD.mqh
  6. Set a breakpoint on line 651 in Expert.mqh
  7. Start with CTRL + F5 to run on historical data
  8. Place the cursor on a fully closed candlestick (at least 1-2 days back)
  9. When the breakpoint is reached, activate the visual tester and press Ctrl + F
  10. All indicators will shift 1 bar to the left once you press CTRL + F in the visual tester window and get a crosshair.
  11. Continue from the breakpoint and all indicators will move 1 bar to the right.
  12. Steps 8 to 11 can be repeated and always do the same thing.

The problem is that when checking if the EA is actually doing what it is supposed to, it is not possible when the bars are shifted compared to what the EA sees.

This is not a problem with indicators, as it is even the case with built-in EA examples as well as with built-in indicators.


This YouTube video demonstrates the problem at about 0:25, press Ctrl + F.

https://youtu.be/_fyCv3Zla9A

 
fxsaber:

Now you can select any pass from the Optimisation results based on your criterion for selecting the best pass.

But it is impossible to set your own Optimisation criterion if there is only EX5. From my point of view, such an Optimisation criterion could be set as an EA, where only OnTester and TesterStatistics function data are available. Most likely, there is no such thing in the developers' plans. That is why only the sounding is available.

Have you realized it only now? If you have a bad model of the trading strategy, no optimization helps at all.

So mathematical modeling or machine learning cannot solve this problem. You need to know clearly what is in the black box.

 
Petros Shatakhtsyan:

Have you only realised this now?

I don't understand the pattern of such illogical questions.

If you have a bad trading strategy model, no amount of optimisation helps.

Of course, if someone is bad, they are not good. That's exactly what the sentence above sounds like.

I.e. mathematical modelling or machine learning is not up to the task. You have to know clearly what's in the black box.

This sentence is talking about a task of some kind. And that something needs to be known for some purpose. In general, it is better if the answers don't look like a torn out piece of conversation with yourself.

 
fxsaber:

There are no grails.

There are.

 
Алексей Тарабанов:

Check.

The assertion of graality (before the Tester mode fix) has been confirmed by the code.

 

In some of the latest builds importing of tst-file became incomplete - Settings tab is not updated to the one in tst.

Previously, you import and in Settings you can immediately see at what values the result was obtained. I can't see it now. Is it possible to switch back?

 
For a long time I searched for the reason of the tester's strange behaviour in real ticks. Found it.
const bool Init = EventSetTimer(1);

void Func()
{
  static datetime PrevTime = 0;
  
  const datetime time = TimeTradeServer();
  
  if (time < PrevTime)
    DebugBreak(); // Срабатывает
  
  PrevTime = time;
}

void OnTick()
{
  Func();
}

void OnTimer()
{
  Func();
}

The server time runs forward and then comes back. This happens on a real trade server, but managed to create a replay on a custom symbol.


Let's run

sinput datetime inDateFrom = D'2020.01.01';

void OnStart()
{
  const string Name = "TEMP12345";                                                           // Имя кастомного символа
  const string SymbOrig = "EURUSD";                                                          // Имя оригинального символа

  MqlTick Ticks[];
  
  const int Size = CopyTicksRange(SymbOrig, Ticks, COPY_TICKS_ALL, (long)inDateFrom * 1000); // Считали EURUSD-тики.
    
  if ((Size > 0) && CustomSymbolCreate(Name, NULL, SymbOrig) && SymbolSelect(Name, true))    // Создали символ на основе EURUSD.
  {
    CustomTicksReplace(Name, 0, LONG_MAX, Ticks);                                            // Поместили в него историю EURUSD.        
    
    CustomRatesDelete(Name, D'2020.01.03 23:00', D'2020.01.04 00:00');                       // Удалили несколько баров.
  }
}


A symbol with tick history will be created, but with several bars deleted. Then we start debugging the EA above in this mode.

[Tester]
Symbol=TEMP12345
Period=M1
Optimization=0
Model=4
FromDate=2020.01.01
ToDate=2020.01.08
ForwardMode=0
Deposit=100000
Currency=USD
ProfitInPips=1
Leverage=100
ExecutionMode=0
OptimizationCriterion=6


It stops.

You can see that time has gone in a second loop.

 
fxsaber:

In some of the latest builds importing of tst-file became incomplete - Settings tab is not updated to the one in tst.

Previously, you import and in Settings you can immediately see at what values the result was obtained. I can't see it now. Is it possible to switch back?

Yes, we can.