Custom Bar Type using Market Data and/or Market Depth
I have no experience in coding custom bars, however I am really interested in creating a custom bar type for Order Flow statistical analysis. What I want to do is create a new bar for each unique spread(Bid Ask combination) in order to be able to run analysis on what the book is doing and how price is reacting to it. There are two issues that I have no idea how to approach:
1) How can I access the current Ask and current Bid in a custom bar type?
2) How can I change the logic of the bars for historical data, because obviously bid/ask data will not be available.
I'm not sure you will accomplish much with the exercise.
But you really don't need a custom bar type to do this.
If you write/buy an indicator to display the bid/ask on each bar it will look something like this:
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).
The bid/ask totals are shown on each bar beside the bar.
The bottom is the total for that bar with percent bid/ask displayed.
This indicator can also show a graphic histogram on the bar if desired.
This uses a 1 Range bar type.
The reason it is on a special bar type (Rich Range) is because the indicator I have only works on that bar type.
There are many examples in current indicators about accessing the bid/ask totals.
Look in some real time indicators to find the answer.
Usually the routines are in the
areas in the indicators
Rejoice in the Thunderstorms of Life . . .
Knowing it's not about Clouds or Wind. . .
But Learning to Dance in the Rain ! ! !
The following user says Thank You to DavidHP for this post:
@DavidHP thanks for your input. I know how to access and use all this information through an indicator, however, I was looking for a bar that is unique to a spread combination.
An example of why a 1 range bar won't work for my needs is as follows:
Say the current spread on the ES is 1517.75/1518.00. If the spread changes to 1518.00/1518.25, but the offer is not hit, a new bar will not be formed. I want a new bar to form as soon as the spread changes.
I want to run a study on orders being added/pulled to the bid and offer, and its reaction to trades hitting them. My idea is to create bars similar to CD, but instead bid/offer contracts. However, this is useless unless each bar is only one spread. I pay attention to order flow a lot, and this is something I track in my head, but being able to have it on a chart would be helpful.