NexusFi: Find Your Edge


Home Menu

 





Custom Bar Type using Market Data and/or Market Depth


Discussion in NinjaTrader

Updated
    1. trending_up 3,056 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 2 attachments




 
Search this Thread

Custom Bar Type using Market Data and/or Market Depth

  #1 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,377

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.

Anyone have any pointers?

London Calling
Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Deepmoney LLM
Elite Quantitative GenAI/LLM
ZombieSqueeze
Platforms and Indicators
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Are there any eval firms that allow you to sink to your …
Traders Hideout
Exit Strategy
NinjaTrader
 
  #3 (permalink)
 
DavidHP's Avatar
 DavidHP 
Isla Mujeres, MX
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Ninjatrader / Optimus Futures / AmpFutures
Trading: ES / 6E / 6B / CL
Frequency: Every few days
Duration: Minutes
Posts: 1,609 since Aug 2009
Thanks Given: 11,328
Thanks Received: 2,743



Xav1029 View Post
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.

Anyone have any pointers?


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:

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
 
Code
OnMarketData
areas in the indicators

FWIW

Rejoice in the Thunderstorms of Life . . .
Knowing it's not about Clouds or Wind. . .
But Learning to Dance in the Rain ! ! !
Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,377


DavidHP View Post
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:

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
 
Code
OnMarketData
areas in the indicators

FWIW

@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.

London Calling
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
DavidHP's Avatar
 DavidHP 
Isla Mujeres, MX
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Ninjatrader / Optimus Futures / AmpFutures
Trading: ES / 6E / 6B / CL
Frequency: Every few days
Duration: Minutes
Posts: 1,609 since Aug 2009
Thanks Given: 11,328
Thanks Received: 2,743

That is what 1 Range does



But I'm sure you will need to discover this for yourself...
So good luck in your journey.

Rejoice in the Thunderstorms of Life . . .
Knowing it's not about Clouds or Wind. . .
But Learning to Dance in the Rain ! ! !
Follow me on Twitter Reply With Quote
  #6 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,377


DavidHP View Post
That is what 1 Range does



But I'm sure you will need to discover this for yourself...
So good luck in your journey.

@DavidHP are rich range bars what I'm looking for? Here is what I get on a 1 range bar:


Edit: Also, the bar you have an oval around should be two bars for what I'm looking to do.

London Calling
Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on February 17, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts