NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 05-05-2008, 02:25 PM   #1
maxima
Senior Member
 
Join Date: Apr 2008
Posts: 298
Thanks: 4
Thanked 0 times in 0 posts
Default Bug in OnMarketDepth

I have code:

protectedoverridevoid OnMarketDepth(MarketDepthEventArgs e)
{
Print(
string.Format("Depth: {0} {1} {2} {3}", e.MarketDataType, e.Operation, e.Price, e.Volume));

which produces output:
Depth: Ask Insert 113.7 25
Depth: Ask Insert 113.72 20
Depth: Ask Insert 113.73 159
Depth: Ask Insert 113.74 185
Depth: Ask Insert 113.75 152
Depth: Ask Insert 113.76 196
Depth: Bid Insert 113.69 20
Depth: Bid Insert 113.71 16
Depth: Bid Insert 113.7 34
Depth: Bid Insert 113.69 191
Depth: Bid Insert 113.68 330
Depth: Bid Insert 113.67 282


113.69 comes twice. In the NT DOM it is 20. But in the code I have to replace with 191 as it came after.

DOM is pretty much static - after trading hours it doesnt move at all. 20 was before I reloaded my indicator and 20 after that.

But in my data it is 191.

I connected to IB.

I need this somehow fixed as I cant count volume in bid/ask ladders.

Thanks
maxima is offline  
Reply With Quote
Old 05-05-2008, 02:42 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

OnMarketData() is correct in its events. Try switching DOM to different instrument and back again to see if it shows the 191.
NinjaTrader_Ray is offline  
Reply With Quote
Old 05-05-2008, 02:44 PM   #3
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

To double check, are you using SuperDOM or Level II window? If this is a stock, you should use Level II window. You likely will see two rows for the price 113.69 each with different volume levels. This is an insert operation not an updata at that price level.
NinjaTrader_Ray is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OnMarketDepth details ct General Programming 5 11-30-2007 06:01 AM
Play beep OnMarketDepth MrBaffalo Indicator Development 4 11-19-2007 10:39 PM


All times are GMT -6. The time now is 10:03 PM.