PDA

View Full Version : Indicator: Using custom events to output the current Level II data book


NinjaTrader_Josh
03-04-2008, 12:40 PM
Reference sample for NinjaTrader 6.5.XXXX.X or greater.

Custom events allow you the flexibility to access indicator/price information whenever you deem it necessary. You do not need to wait for the next incoming tick or next bar update before you can process some code logic.


This reference sample demonstrates the following concept:

Creating a custom event from a Timer object
Printing Level II books whenever you receive a Timer event

A reference sample demonstrating how to build your own Level II book can be found here: http://www.ninjatrader-support.com/vb/showthread.php?t=3478

Important methods and properties used include:

TriggerCustomEvent() (http://www.ninjatrader.com/support/helpGuides/nt7/triggercustomevent.htm)
OnTermination() (http://www.ninjatrader.com/support/helpGuides/nt7/ontermination.htm)
Timer

Other methods and properties of interest include:

MarketDataType
Operation
ArrayList (http://msdn2.microsoft.com/en-us/library/system.collections.arraylist%28VS.71%29.aspx)

Import instructions for NinjaTrader 6.5.XXXX.X or greater:

Download the file contained in this thread to your PC desktop
From the Control Center window, select the menu File > Utilities > Import NinjaScript
Select the downloaded file