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 03-30-2007, 01:53 AM   #1
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
Post imported post

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
Attached Files
File Type: zip DepthReferenceSample.zip (2.1 KB, 284 views)
NinjaTrader_Ray is offline  
Reply With Quote
Old 03-31-2007, 04:35 AM   #2
rtrader
Member
 
Join Date: Mar 2007
Location: London, UK
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Ray -

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


rtrader is offline  
Reply With Quote
Old 06-21-2007, 09:17 AM   #3
RedDuke
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 104
Thanks: 1
Thanked 0 times in 0 posts
Default

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 is offline  
Reply With Quote
Old 04-14-2009, 03:02 PM   #4
jcash
Member
 
Join Date: Jun 2008
Location: Chicago
Posts: 32
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by RedDuke View Post
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.
jcash is offline  
Reply With Quote
Old 04-14-2009, 03:05 PM   #5
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

You should be able to. It would probably be done in the same fashion you have it as over in OnMarketData().
NinjaTrader_Josh is offline  
Reply With Quote
Old 04-14-2009, 04:19 PM   #6
jcash
Member
 
Join Date: Jun 2008
Location: Chicago
Posts: 32
Thanks: 0
Thanked 0 times in 0 posts
Default

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.
jcash is offline  
Reply With Quote
Old 04-15-2009, 07:24 AM   #7
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

jcash,

Those are not supported MarketDepthEventArgs. Please see this article: http://www.ninjatrader.com/support/h...DepthEventArgs
NinjaTrader_Josh is offline  
Reply With Quote
Old 07-02-2007, 08:28 PM   #8
RedDuke
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 104
Thanks: 1
Thanked 0 times in 0 posts
Default

Anybody??? I thought that this feature is being used by a lot of people.
Thanks,
redduke
RedDuke is offline  
Reply With Quote
Old 07-12-2007, 09:28 AM   #9
mwusu
Junior Member
 
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
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
mwusu is offline  
Reply With Quote
Old 07-12-2007, 09:30 AM   #10
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

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


All times are GMT -6. The time now is 02:07 PM.