How to calculate the direction of last ticks volume?

To add comments, please log in or register
Duramade
17
Duramade  

Hello,

I´m practicing on a ForexTime metatrader 5 demo account and i found a function that displays the direction of the volume (whether buy or sell) of the last tick. If you see the little red "circles" in the attachment you should understand where I´m pointing to. I have access to level 2 data and tried hard to figure out how the direction is calculated. Actually I want to write something that maybe can make use of this information but i don´t know to access it or how to calculate it for myself. Maybe someone could tell me? - or maybe there is something related to orderbooks that i don´t understand at all and there is something "readable" that teaches me how to do this?

Thank you and greetings

Duramade

Files:
volume.png 100 kb
Alain Verleyen
39027
Alain Verleyen  
See this article https://www.mql5.com/en/articles/1179
MQL5 Cookbook: Handling BookEvent
MQL5 Cookbook: Handling BookEvent
  • 2014.10.22
  • Dennis Kirichenko
  • www.mql5.com
This article considers BookEvent - a Depth of Market event, and the principle of its processing. An MQL program, handling states of Depth of Market, serves as an example. It is written using the object-oriented approach. Results of handling are displayed on the screen as a panel and Depth of Market levels.
Duramade
17
Duramade  
okay.. thanks for the response, it´s a great article but i already managed to receive the orderbook through a indicator printing it to the console. What i really need is an explanation of how metatrader determines the direction of the last received volume. How does metatrader know whether the last volume have to be colored blue or red? - or whether the arrow have to point up or down? (see attachment). I can´t see any relationship between the "color of the last volume" and moving of the bid or ask - so how can metatrader know?
Alain Verleyen
39027
Alain Verleyen  
Duramade:
okay.. thanks for the response, it´s a great article but i already managed to receive the orderbook through a indicator printing it to the console. What i really need is an explanation of how metatrader determines the direction of the last received volume. How does metatrader know whether the last volume have to be colored blue or red? - or whether the arrow have to point up or down? (see attachment). I can´t see any relationship between the "color of the last volume" and moving of the bid or ask - so how can metatrader know?
If the last trade was a buy, it's blue, if it was a sell it's red.
Duramade
17
Duramade  
and how can metatrader know that it was a buy or a sell? - you can not say that the volume was definitely a buy or a sell just by observing jumps in the bid and ask.
Alain Verleyen
39027
Alain Verleyen  
Duramade:
and how can metatrader know that it was a buy or a sell? - you can not say that the volume was definitely a buy or a sell just by observing jumps in the bid and ask.

This information is provided by the broker. That's what level 2 data are for.

Anyway, Forex market is not centralized and these information are only about what happened at broker side.

Duramade
17
Duramade  
okay.. and when its provided by the broker how can the data be accessed within a mql5 script or indicator?
Eduardo Gonzatti
215
Eduardo Gonzatti  
Any news in this? 
I too have interest in this issue,  as I'm trying to create a counter that sums up and down ticks for a moving window. 
To add comments, please log in or register