Download MetaTrader 5

Strategy Tester and spread evolution

To add comments, please log in or register
Find out how to use widgets at MQL5.community
Etienne Chabert
249
Etienne Chabert 2013.11.14 12:32 

Hi ;)

Basic question : I have try to used the Strategy Tester to follow step by step how an important news impact a major pair like EURUSD. But I am a bit disappointed because even if I am in every tick mode for the simulation the spread look to be fixed for one minute

For example  : 2013.11.07 for Alpari ECN on EURUSD

- at 14:44 -> Spread of 68

- at 14:45 -> Spread of 148

- at 14:46 -> Spread of 36

But can't follow spread evolution tick by tick

First question : Is it a limitation of my broker or of metatrader platform ?

Bonus question : Did the spread value used for the simulation is the lowest ( I am probably joking ;) ), the average, or the highest real spread of the minute ? 

Thank's 

Alain Verleyen
Moderator
30714
Alain Verleyen 2013.11.14 13:14  
wizmoisa:
...

First question : Is it a limitation of my broker or of metatrader platform ?

This is a limitation of MT5 platform and Strategy tester. Nothing to do with the broker.


Bonus question : Did the spread value used for the simulation is the lowest ( I am probably joking ;) ), the average, or the highest real spread of the minute ? 

Thank's 

Good question. It's probably written somewhere on the site, please inform us if you find it.

Anyway, you can monitor the spread on a live chart, there the spread is updated on each tick.

Etienne Chabert
249
Etienne Chabert 2013.11.14 13:43  

angevoyageur: 


Anyway, you can monitor the spread on a live chart, there the spread is updated on each tick.

You are right but my goal is to analyse past news and there implication on a pair, that's why I used the strategy tester to "travel to the past" ;)

I didn't found any detail about the spread implementation in the strategy tester, so I opened a service desk ticket to ask more information.

Alain Verleyen
Moderator
30714
Alain Verleyen 2013.11.14 14:04  
wizmoisa:

You are right but my goal is to analyse past news and there implication on a pair, that's why I used the strategy tester to "travel to the past" ;)

I didn't found any detail about the spread implementation in the strategy tester, so I opened a service desk ticket to ask more information.

I doubt you get a reply. Service Desk is not there to answer such question in my opinion. As you noted yourself, the spread used in the Strategy Tester comes from minute data. It's fixed for 1 minute.

Etienne Chabert
249
Etienne Chabert 2013.11.14 14:33  
angevoyageur:

I doubt you get a reply. Service Desk is not there to answer such question in my opinion. As you noted yourself, the spread used in the Strategy Tester comes from minute data. It's fixed for 1 minute.

Calculation techniques is an important point to understand I guess
Alain Verleyen
Moderator
30714
Alain Verleyen 2013.11.14 14:55  
wizmoisa:
Calculation techniques is an important point to understand I guess

https://www.mql5.com/en/articles/75

https://www.mql5.com/en/docs/runtime/testing#spread

The Algorithm of Ticks’ Generation within the Strategy Tester of the MetaTrader 5 Terminal
The Algorithm of Ticks’ Generation within the Strategy Tester of the MetaTrader 5 Terminal
  • 2010.06.02
  • MetaQuotes Software Corp.
  • www.mql5.com
MetaTrader 5 allows us to simulate automatic trading, within an embedded strategy tester, by using Expert Advisors and the MQL5 language. This type of simulation is called testing of Expert Advisors, and can be implemented using multithreaded optimization, as well as simultaneously on a number of instruments. In order to provide a thorough testing, a generation of ticks based on the available minute history, needs to be performed. This article provides a detailed description of the algorithm, by which the ticks are generated for the historical testing in the MetaTrader 5 client terminal.
Etienne Chabert
249
Etienne Chabert 2013.11.14 15:27  

Thank's for this links Ange,

The tick data are not real but generated, I totaly missed this detail ... For me I was training my robot on true historical data in every tick mode.

In fact I can only trust OHLC value, witch are based on historical data.

But I didn't found any details on spread value indicated for every minute bar in simulation.

Etienne Chabert
249
Etienne Chabert 2013.11.14 15:45  

The price difference between the Bid and the Ask prices is called the spread. During testing, the spread is not modeled but is taken from historical data. If the spread is less than or equal to zero in the historical data, then the last known spread is used by testing agent.

Excuse me, to be honest this part give details about spread in simulation. But it's very strange because my tests show me that spreads are fixed for a minute during a simulation

So following this part of article "Simulation of spread" :

I only got valid spread data for the first tick of each minute, and other tick has data with spread less than or equal to zero ? This implementation is worst than a spread calculated in function of average or highest spread values. It can increase the gap between simulation and reality (in reality your SL can be trigger by a jump of spread but for the same period in simulation, nothing happen ...)

Alain Verleyen
Moderator
30714
Alain Verleyen 2013.11.14 15:53  
wizmoisa:

Excuse me, to be honest this part give details about spread in simulation. But it's very strange because my tests show me that spreads are fixed for a minute during a simulation

So following this part of article "Simulation of spread" :

I only got valid spread data for the first tick of each minute, and other tick has data with spread less than or equal to zero ? This implementation is worst than a spread calculated in function of average or highest spread values. It can increase the gap between simulation and reality (in reality your SL can be trigger by a jump of spread but for the same period in simulation, nothing happen ...)

During testing spread is taken from historical data : that means spread is the same for 1 minute, as there is only 1 value for spread during this minute.

I do some test and from what I can see, recorded spread in 1 minute candle is the max spread of this minute.

Etienne Chabert
249
Etienne Chabert 2013.11.14 16:06  
angevoyageur:

During testing spread is taken from historical data : that means spread is the same for 1 minute, as there is only 1 value for spread during this minute.

I do some test and from what I can see, recorded spread in 1 minute candle is the max spread of this minute.

I have also try to do my own test but it's right now impossible : The strategy tester can't simulate the current day.

But tomorrow I will get the answer about this implementation (I will do a comparison between a tracking log of all bar's ticks recorded today and the same bar in simulation).

I guess too that the recorded spread for a minute is the maximum, but I prefer to be sure.

Anyway I am grateful to you for this details about simulations ;)

Alain Verleyen
Moderator
30714
Alain Verleyen 2013.11.14 16:18  
wizmoisa:

I have also try to do my own test but it's right now impossible : The strategy tester can't simulate the current day.

But tomorrow I will get the answer about this implementation (I will do a comparison between a tracking log of all bar's ticks recorded today and the same bar in simulation).

I guess too that the recorded spread for a minute is the maximum, but I prefer to be sure.

Anyway I am grateful to you for this details about simulations ;)

You are welcome. Let us know your results.
To add comments, please log in or register