Download MetaTrader 5

Bid Ask Bar History Data

To add comments, please log in or register
Sell products via the Market and track your sales statistics
MathQuant
73
MathQuant 2014.05.12 13:02 


I am trying to program a strategy in MQL5 that requires the following history data:


   Bid bar history data required:      Open   High   Low   Close   Volume 

   Ask bar history data required:      Open   High   Low   Close   Volume


By history I mean a few bars previous to the current bar.

If anyone knows of a code which can get that information, and is willing to share it, I would be most grateful.




Rodrigo Malacarne
Moderator
9895
Rodrigo Malacarne 2014.05.12 13:26  
MathQuant:

I am trying to program a strategy in MQL5 that requires the following history data:


By history I mean a few bars previous to the current bar.

If anyone knows of a code which can get that information, and is willing to share it, I would be most grateful.

You can start by taking a look at this article: https://www.mql5.com/en/articles/60.
Creating Tick Indicators in MQL5
Creating Tick Indicators in MQL5
  • 2010.04.23
  • Denis Zyatkevich
  • www.mql5.com
In this article, we will consider the creation of two indicators: the tick indicator, which plots the tick chart of the price and tick candle indicator, which plot candles with the specified number of ticks. Each of the indicators writes the incoming prices into a file, and uses the saved data after the restart of the indicator (these data also can be used by the other programs)
MathQuant
73
MathQuant 2014.05.12 13:56  
Malacarne:
You can start by taking a look at this article: https://www.mql5.com/en/articles/60.


Thanks Malacarne, I will look again at that article more closely.

Alain Verleyen
Moderator
30731
Alain Verleyen 2014.05.12 15:09  
MathQuant:


I am trying to program a strategy in MQL5 that requires the following history data:


   Bid bar history data required:      Open   High   Low   Close   Volume 

   Ask bar history data required:      Open   High   Low   Close   Volume


By history I mean a few bars previous to the current bar.

If anyone knows of a code which can get that information, and is willing to share it, I would be most grateful.

You have to use CopyXXX function to get history data : CopyHigh(), CopyLow(), etc...
Uwe Goetzke
1441
Uwe Goetzke 2014.05.12 16:47  

For the ask bar you will have "build" your own bar, using the ask tick prices.

Volume information is a bit diffcult, as the volume is just exchanged where the seller gets the bid price and the buyer pays the ask price

(and the difference between bid and ask, the spread, is for the "work" of the broker(-s) ).

So in my opinion from a single trade you have no way to say if it is a sell or buy volume, in other words the volume is just exchanged and the amount is identical for both sides.

Which of both parties has entered or left the market one cannot determine from the tick data feed.

So one has to look at the volumes in the context of price and time, and here I would split the volume between the ask and bid price.

MathQuant
73
MathQuant 2014.05.15 11:54  
angevoyageur:
You have to use CopyXXX function to get history data : CopyHigh(), CopyLow(), etc...

Thanks

MathQuant
73
MathQuant 2014.05.15 12:14  
ugo58:

For the ask bar you will have "build" your own bar, using the ask tick prices.

Volume information is a bit diffcult, as the volume is just exchanged where the seller gets the bid price and the buyer pays the ask price

(and the difference between bid and ask, the spread, is for the "work" of the broker(-s) ).

So in my opinion from a single trade you have no way to say if it is a sell or buy volume, in other words the volume is just exchanged and the amount is identical for both sides.

Which of both parties has entered or left the market one cannot determine from the tick data feed.

So one has to look at the volumes in the context of price and time, and here I would split the volume between the ask and bid price.


Thanks, I think you are right about building my own ask bars.

Regarding volume, if the broker is also the market maker, then it is possible for the broker to know whether the deal was initiated by a buyer or a seller.  In which case Bid Volume and Ask Volume can be meaningfully reported.  Check out the link in this post    https://www.mql5.com/en/forum/1678#comment_147023

MetaQuotes should seriously consider adding Ask Bar Charts to MT5.

Rodrigo Malacarne
Moderator
9895
Rodrigo Malacarne 2014.05.15 12:21  
MathQuant:


Thanks, I think you are right about building my own ask bars.

Regarding volume, if the broker is also the market maker, then it is possible for the broker to know whether the deal was initiated by a buyer or a seller.  In which case Bid Volume and Ask Volume can be meaningfully reported.  Check out the link in this post    https://www.mql5.com/en/forum/1678#comment_147023

I think MetaQuotes should seriously consider adding Ask Bar Charts to MT5.

Have you seen this poll ?
MathQuant
73
MathQuant 2014.05.15 12:57  
Malacarne:
Have you seen this poll ?


Yes, I added a reply a few days ago.

To add comments, please log in or register