Is volume accessible by EA during tests?

 

I found it strange that my EA cannot read volume during tests, although, the Strategy Tester is showing it. That means I have good data.

Is this expected? I am implementing inside the OnTick() event. I am having all attributes of the tick, except the volume. I am using MT5.

In the images is the volume correct being showing in Strategy Tester and 0 in the EA when I am debugging it.

 
metadevEU:

I found it strange that my EA cannot read volume during tests, although, the Strategy Tester is showing it. That means I have good data.

Is this expected? I am implementing inside the onTick() event. I am having all attributes of the tick, except the volume. I am using MT5.


In the images is the volume correct being showing in Strategy Tester and 0 in the EA when I am debuging it.

This is due to a misconception on your side.

MqlTick itself is the tick. If you load tick data for 3 minutes and the array has a size of 100, your tick volume is 100...

Although, not every tick you get also accounts for being a tick counted for the tick_volume.

The tick volume only counts specific ticks as tick volume. So you will have more tick data in your array than actual tick volume for the same time scope.

MT5 : ticks data questions, issues and bugs. All about ticks. - What I've learned from MT5: No EA is reliable if sl or tp are smaller than (high-low) tested on
MT5 : ticks data questions, issues and bugs. All about ticks. - What I've learned from MT5: No EA is reliable if sl or tp are smaller than (high-low) tested on
  • 2018.11.26
  • www.mql5.com
What i've learned from mt5: no ea is reliable if sl or tp are smaller than (high-low) tested on ohlc. To use tick for backtesting: careful filtering and step-by-step checking, among other things. Closer, but still some differences
 

It works just fine. It's probably a bug in your code.

However, please note that there is a difference between tick volume and real volume. Forex and CFD's don't usually have real volume, only tick volume.

 
Fernando Carreiro #:

It works just fine. It's probably a bug in your code.

However, please note that there is a difference between tick volume and real volume. Forex and CFD's don't usually have real volume, only tick volume.

Not bug in my side. I am debugging a MT5 object, the MqlTick itself.

Probably is a misunderstanding of how it works.

 
Dominik Egert #:
This is due to a misconception on your side.

MqlTick itself is the tick. If you load tick data for 3 minutes and the array has a size of 100, your tick volume is 100...

Although, not every tick you get also accounts for being a tick counted for the tick_volume.

The tick volume only counts specific ticks as tick volume. So you will have more tick data in your array than actual tick volume for the same time scope.

I found an explanation:

  1. The Forex market is decentralized, which means there isn't a single unified exchange reporting volume data. The volume you see in MT5 represents the trading activity of participants within your broker's liquidity pool, not the entire Forex market. This volume might not be an accurate representation of market-wide activity.

  2. Volume vs. Tick Volume: In the Forex market, the concept of volume is different from stock markets. Instead of representing the total number of contracts or lots traded, it often reflects the number of price updates (ticks) that have occurred. This is sometimes called "tick volume". 


So I believe that, in Forex, I will not have the volume because each tick counts as 1.  It stock market I might get it. Do you confirm it, Dominik?

 
metadevEU #:

I found an explanation:

  1. The Forex market is decentralized, which means there isn't a single unified exchange reporting volume data. The volume you see in MT5 represents the trading activity of participants within your broker's liquidity pool, not the entire Forex market. This volume might not be an accurate representation of market-wide activity.

  2. Volume vs. Tick Volume: In the Forex market, the concept of volume is different from stock markets. Instead of representing the total number of contracts or lots traded, it often reflects the number of price updates (ticks) that have occurred. This is sometimes called "tick volume". 


So I believe that, in Forex, I will not have the volume because each tick counts as 1.  It stock market I might get it. Do you confirm it, Dominik?

Yes, sort of. There have been studies concerning tick volume and their representation as well as the effects on market movements. It sho s tick volume is about as accurate as real volume.

Real volume really depends on the underlying asset. IE stocks are for example Tesla, traded at multiple exchanges. You will still only get the volume at the exchange to which your broker has signed up to. And this is also only actually true, if the stock is not traded through a CFD.

Or a future contract, if supplies real volume, you would only get the volume from this one specific futures contract, but multiple brokers might have "the same" future in their portfolio, but from different clearing houses, so the contract name might be the same, representing the same underlying asset, but actually different contracts.

In essence, the volume or tick volume will very seldom represent the true volume traded at the exchanges.
 
Dominik Egert #:
Yes, sort of. There have been studies concerning tick volume and their representation as well as the effects on market movements. It sho s tick volume is about as accurate as real volume.

Real volume really depends on the underlying asset. IE stocks are for example Tesla, traded at multiple exchanges. You will still only get the volume at the exchange to which your broker has signed up to. And this is also only actually true, if the stock is not traded through a CFD.

Or a future contract, if supplies real volume, you would only get the volume from this one specific futures contract, but multiple brokers might have "the same" future in their portfolio, but from different clearing houses, so the contract name might be the same, representing the same underlying asset, but actually different contracts.

In essence, the volume or tick volume will very seldom represent the true volume traded at the exchanges.

Interesting. Price and volume are the two most important things for many successful traders.

 
Dominik Egert #:
Yes, sort of. There have been studies concerning tick volume and their representation as well as the effects on market movements. It sho s tick volume is about as accurate as real volume.

Real volume really depends on the underlying asset. IE stocks are for example Tesla, traded at multiple exchanges. You will still only get the volume at the exchange to which your broker has signed up to. And this is also only actually true, if the stock is not traded through a CFD.

Or a future contract, if supplies real volume, you would only get the volume from this one specific futures contract, but multiple brokers might have "the same" future in their portfolio, but from different clearing houses, so the contract name might be the same, representing the same underlying asset, but actually different contracts.

In essence, the volume or tick volume will very seldom represent the true volume traded at the exchanges.

I also noticed that the MqlTick.last field is not populated when live. With the strategy tester it is populated, though.

I believe it is a similar case with the volume data. As it is OTC market and decentralised, the last price would not be very accurate. 

Now I don't understand why the strategy tester populates it. Is it to simplify testing? Maybe to help simulating the price paid during the buy/sell?

In my use case it does not help. I was counting with this field to develop my strategies, now it seems I cannot use it.

All I wrote are only hypothesis. I would to hear an opinion/confirmation of you guys. 

 
Dominik Egert #:
Yes, sort of. There have been studies concerning tick volume and their representation as well as the effects on market movements. It sho s tick volume is about as accurate as real volume.

Source(s) ?

 
Alain Verleyen #:

Source(s) ?


There is more to find on this topic, but for the argument, here is a study paper:


You will find all types of current studies around tick size, which is more recent, and covered a different area of markets.

Here is the Google search:



 
Can you guys confirm if the Strategy Tester populates the MqlTick.last even when the broker does not provide this information? Is this the expected behaviour?