Analysis of test results and optimisation in the MetaTrader 5 strategy tester - page 14

 
Ilya Malev #:
The task was to make the tester take into account, when checking the execution of orders on a given bar, high and low-ask in the testing mode Only bar opening (for example, H1).

You can play with MqlRates.spread to achieve High/Low-ask. I don't know how this field affects the generation of asks now.

The task is really to find the golden mean between accuracy and speed. It might make sense to thin the ticks a lot and use the corresponding custom symbol in the real ticks mode.

 
fxsaber #:

The challenge is actually to find the golden mean between accuracy and speed. Perhaps it makes sense to thin the ticks a lot and use the corresponding custom symbol in the real ticks mode.

You can try it that way.

#property script_show_inputs

input string inName = "";
input datetime inFrom = D'2025.01.01';
input datetime inTo = D'2026.01.01';
input ENUM_TIMEFRAMES inPeriod = PERIOD_CURRENT;
input int inMinPips = 0;

#include <fxsaber\TicksShort\LotsTicks.mqh> // https://www.mql5.com/en/code/61126

void OnStart()
{
  LOTS_TICKS LotsTicks;
  
  if ((LotsTicks.CopyTicksRange(_Symbol, COPY_TICKS_ALL, inFrom * 1000, inTo * 1000) > 0) &&   
      (LotsTicks.Filter(inMinPips, PeriodSeconds(inPeriod)) > 0))
  {
    const string Name = (inName == "") ? "FILTER" + (string)inMinPips + "_" + _Symbol : inName;
    
    if (CustomSymbolCreate(Name, NULL, _Symbol) &&
        (LotsTicks.CustomTicksReplace(Name) > 0) &&
        SymbolSelect(Name, true))
      ChartOpen(Name, _Period);
  }
}
 
fxsaber #:

You could try it that way.

The problem is that if we use wildcard ticks instead of just the opening prices, making the Real ticks mode, the orders will be executed not at the price of their placing (as in the Just opening prices mode), but at the prices of the first ticks after their crossing, which will be absolutely inadequate execution if there are only a few ticks per hour. On this basis:

fxsaber #:
Yes.
 
Ilya Malev #:

The problem is that if we use wildcard ticks instead of just the opening prices, making the Real ticks mode, the orders will be executed not at the price of their placing (as in the Just opening prices mode), but at the prices of the first ticks after their crossing, which will be absolutely inadequate execution if there are only a few ticks per hour. Proceeding from this:

Execution with slippage is the norm.
 
fxsaber #:
Executing with slippage is the norm.
A few pips is the norm, not half a bar.
 
And in the case of take-outs and limits, assuming that they are sliding in the plus range, it will be an unprecedented ride of generosity. Considering that they rarely slip in practice at all
 
Ilya Malev #:
they rarely slip in practice at all.
I've had the opposite experience.
 
Ilya Malev #:
The task was to make the tester take into account, when checking the execution of orders on a given bar, high and low-asks in the mode of testing Only opening bars (for example, H1).

The tester does exactly that: all 4 control points of the bar (OHLC/OLHC) are additionally analysed in the mode by opening prices.

...the call of the OnTick handler will occur only at the opening of hour bars. On the other ("hidden" from the Expert Advisor) ticks the checks necessary for correct testing take place:

  • calculation of margin requirements;
  • triggering of Stop Loss and Take Profit;
  • triggering of pending orders;
  • deleting pending orders with expired time.

In addition, I have recently found out that the times of these additional control points are artificially chosen to be equal to the last three seconds of the bar.
 
Stanislav Korotky #:
The tester does exactly that: in the mode by opening prices all 4 bar control points (OHLC/OLHC) are additionally analysed.

Not everything is so simple. Imagine a sequence of real ticks inside some bar

Tick 90 Bid / 90 Ask (bar opening)

Tick 98 Bid / 102 Ask

Tick 95 Bid / 110 Ask

Tick 62 Bid / 75 Ask

Tic 71 Bid / 72 Ask

Tick 90 Bid / 90 Ask (bar closing)


Let's assume that orders were placed at the opening

Buy Stop at 108

Buy Limit at 72

Sell Stop at 65

Sell Limit at 96


Show 4 control ticks that must be selected in this bar for all these orders on this bar to be triggered, as they will be in the "Real Ticks" mode.

 
fxsaber #:
I have the opposite experience.
"Generosity ride" in the case of limit slippages to prices of the nearest ticks, on potical models like "OHLC" does not cancel it.