Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Level 2
Collapse
X
-
Tags: None
-
Hello nightriderx,
Market depth uses an index position for reference. Unfortunately it's not as simple as providing a price level to check number of contracts offered. It is possible to custom code this and this sample can help you work with market depth programatically.
Ryan M.NinjaTrader Customer Service
-
Thanks Ryan.
Another question I have is what happens when the bid from the previous bar is called. ie. if I wanted to make an indicator that plots the sma of the ask price...what value would it use for the previous bar? would it be of the last tick of that bar? the avg? or something else? I am finding that these values vary dramatically from real time to recorded data...any idea why that may be? Theoretically, as I understand, they both give you the value of every new incoming tick...
Comment
-
It's challenging to sync these up because they represent different events. OnBarUpdate() is raised only when a trade occurs and OnMarketDepth() is raised for every change in level II data. The changes can be caused by trades occurring, but also orders cancelled or added at various price levels. When you access a value within OMD you're getting the last updated value within that context. You have to custom code any syncing with bar updates compared to other events like OMD.
If you want an SMA of the ask price, best is to chart the Ask series through the right click > data series screen. You can then apply an SMA directly to this Ask series. This data is not available with all providers. See here for which ones offer historical bid / ask data.
Ryan M.NinjaTrader Customer Service
Comment
-
Right but the bid/ask of the previous bar is set to the last tick (value of bid/ask of the last trade) in that previous bar...is that correct? And thus should correspond to the same exact value on live/recorded/and historical (pulled from the right provider) charts...correct? so my bid sma plot should correspond on a live chart to recorded and historical charts?
Comment
-
Right but the bid/ask of the previous barLast edited by NinjaTrader_RyanM1; 04-19-2011, 02:16 PM.Ryan M.NinjaTrader Customer Service
Comment
-
ok, so how is the sma of bid/ask calculated?...you need previous values...
on what basis is the chart plotted when I select plot based on ask/bid?
this is what I have been trying to figure out...Last edited by nightriderx; 04-19-2011, 02:22 PM.
Comment
-
It can be confusing, as this is a special bar built on changes to bid / ask data. Anytime the ask value changes, a value is plotted at that price level. The main distinction between an ask and last bar is the mechanism for a value change. A standard "last" bar represents only trades that actually occurred, and ask levels can change independent of this.
To get an SMA of ask-level bars, then you have to work with an ask series, or custom code some type of synchronization working between OBU and OMD. They're really two different data sets so you're unable to simply access "the ask of the previous (standard) bar". A standard OHLC bar has only those 4 data points, and they represent the range of trades that actually occurred.Ryan M.NinjaTrader Customer Service
Comment
-
ok, so what you are saying is that there are 3 different series (at level 1) the bid, the ask and the last series, all recorded independently of the other?
thus the bid sma will be plotted based on the OMD series, meaning that if the bid changes 7 times within a second - it will be the sma of those 7 bid prices within that second... and if the ask changes 7 times within 4 seconds - it will be the sma of those 7 bid prices within the 4 seconds...just like if the last price was plotted on a tick basis - it would be the sma of the last 7 ticks...correct?
if so, can you please direct me on how I can add the OMD series (like my bid sma) to my OBU strategy/indicator?Last edited by nightriderx; 04-19-2011, 04:28 PM.
Comment
-
Yes, bid ask and last are all separate data streams.
It really depends what you have coded. You have to pass in a data series in your SMA calculation, which is synced to bars. It's hard to say what it will do without seeing a code snippet. Please share and will take a look here.
There are two event handlers for bid/ ask data.
OnMarketData - Raised with changes to best bid / ask or last.
OnMarketDepth() - Level II data - raised with changes to market depth, which can be up to ten levels on each side.Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Harry, 05-02-2018, 01:54 PM
|
10 responses
3,203 views
0 likes
|
Last Post
by tharton3
Today, 08:52 AM
|
||
Started by cre8able, Yesterday, 01:16 PM
|
3 responses
11 views
0 likes
|
Last Post
by cre8able
Today, 08:28 AM
|
||
Started by ChartTourist, Today, 08:22 AM
|
0 responses
6 views
0 likes
|
Last Post
by ChartTourist
Today, 08:22 AM
|
||
Started by LiamTwine, Today, 08:10 AM
|
0 responses
2 views
0 likes
|
Last Post
by LiamTwine
Today, 08:10 AM
|
||
Started by Balage0922, Today, 07:38 AM
|
0 responses
5 views
0 likes
|
Last Post
by Balage0922
Today, 07:38 AM
|
Comment