PDA

View Full Version : Real-time Marketh Depth Indicator Reference Sample


NinjaTrader_Ray
03-30-2007, 01:53 AM
I have been getting a lot of private requests from individuals asking for a referencesample of how to access market depth (order book) data for the creation of custom indicators. At the time ofthis post, accessing market depth is not part of theofficially supported NinjaScript layer. What I present here is intended for advancedprogrammers andoutside the scope of what we currently provide technical support for.

For those interested,please take a look at theattachedreference indicator. It will show you how to attached market depth event handlers and access some of the depth events as a result.

Ray

rtrader
03-31-2007, 04:35 AM
Ray -

Thanks very much for posting this. Saved a lot of researchand works great.

RedDuke
06-21-2007, 09:17 AM
I am developing an indicator that utilizes market depth. The difficulty that I am having is showing its results on the chart. When I use Plot or DrawText methods within OnBarUpdate they work great, but are only updated once the chart moves and not when market depth changes. Putting the same commands within OnMarketDepth does not work, they are being ignored. Print method does work, but it required output window.

I realize the Ninja does not provide support for this feature, but I want to ask if anyone had any development done with MarketDepth event. How can I display a value on the chart that changes when OnMarketDepth event is being triggered.

Thanks,
redduke

RedDuke
07-02-2007, 08:28 PM
Anybody??? I thought that this feature is being used by a lot of people.
Thanks,
redduke

mwusu
07-12-2007, 09:28 AM
I have been getting a lot of private requests from individuals asking for a referencesample of how to access market depth (order book) data for the creation of custom indicators. At the time ofthis post, accessing market depth is not part of theofficially supported NinjaScript layer. What I present here is intended for advancedprogrammers andoutside the scope of what we currently provide technical support for.

For those interested,please take a look at theattachedreference indicator. It will show you how to attached market depth event handlers and access some of the depth events as a result.

Ray

Is it possible to access this sample indicator from a strategy? I tried and got a "The name 'DepthReferenceSample' does not exist in the current context" error when I tried to compile.

Marcus

NinjaTrader_Ray
07-12-2007, 09:30 AM
Hi Marcus,

This indicator is not accessible from a strategy. With our upcoming NT 6.5 release due out in beta late summer, you will be able to access market depth and data events directly.

jcash
04-14-2009, 03:02 PM
I am developing an indicator that utilizes market depth. The difficulty that I am having is showing its results on the chart. When I use Plot or DrawText methods within OnBarUpdate they work great, but are only updated once the chart moves and not when market depth changes. Putting the same commands within OnMarketDepth does not work, they are being ignored. Print method does work, but it required output window.

I realize the Ninja does not provide support for this feature, but I want to ask if anyone had any development done with MarketDepth event. How can I display a value on the chart that changes when OnMarketDepth event is being triggered.

Thanks,
redduke


I have the same question re setting the plots from within OnMarketDepth, updating with each change in depth data. Is this possible? i have written indicators that set a plot from within OnMarketData, which work fine.

NinjaTrader_Josh
04-14-2009, 03:05 PM
You should be able to. It would probably be done in the same fashion you have it as over in OnMarketData().

jcash
04-14-2009, 04:19 PM
using the following variables b = e.MarketDepth.Bid.TotalVolume(5); a = e.MarketDepth.Ask.TotalVolume(5); within OnMarketDepth, i add Bid.Set(b); and Ask.Set(a); also within OnMarketDepth and get the following error:

Cbi.MarketDepth.MarketDepthItemAddNow: exception caught: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

the variables assign correctly and print in the output window, but no plots.

NinjaTrader_Josh
04-15-2009, 07:24 AM
jcash,

Those are not supported MarketDepthEventArgs. Please see this article: http://www.ninjatrader.com/support/helpGuides/HelpGuideV6/helpguide.html?MarketDepthEventArgs

gartonrd
05-31-2009, 04:12 PM
Got an error when trying to import the indicator. Has the file become corrupted?

NinjaTrader_Bertrand
06-01-2009, 04:50 AM
Please doubleclick on the errors listed to be taken to the offending code lines, which seem to be present in your other installed NinjaScript files. You can then work with those guidelines to compile them successfully - http://www.ninjatrader-support2.com/vb/showthread.php?t=4678

gartonrd
06-01-2009, 12:25 PM
Can't get to the stage of compiling. Can't even import.

NinjaTrader_Josh
06-01-2009, 12:36 PM
gartonrd,

Please open up the NinjaScript Editor on any file you have installed on your NinjaTrader already. Press F5 to compile and you will get a list of errors. Those errors need to be addressed before you can import.

eDanny
06-15-2009, 10:59 AM
I tried this sample and it will not import. There are no errors in any of my NT scripts. I would suggest an updated sample.

NinjaTrader_Bertrand
06-15-2009, 11:07 AM
Guys, thanks for bringing this up - please retry with the attached updated zip. Thanks!

roland_nt
11-28-2011, 11:06 PM
Get Import failed message - dupe or missing file.- Any ideas?
When I forced the .cs file into the indicator folder by copy and paste, it compiled but complained about long vs int.
Is this file really fixed for NT7?

NinjaTrader_Bertrand
11-29-2011, 02:21 AM
Roland, same outcome with the NT7 file from this link here?

http://www.ninjatrader.com/support/forum/showthread.php?t=3478

Thanks,