User Guide‎ > ‎

NinjaScript® Reference


Auction Dashboard™ has an extremely powerful NinjaScript® interface that can be accessed from your own scripts. Access to Auction Dashboard's™ Auction Visualizer™ including event notifications, as well as bar-by-bar and session profile data, makes it possible to develop incredibly powerful strategies, and indicators, leveraging Auction Dashboard's™ abilities.

Scripting access is included with all lifetime license purchases.

Strategy BackTest Limitation

Auction Dashboard™ will not run in a strategy that executes in a BackTest. The reason for this is as so: Indicators that execute in a BackTest are not fed tick-by-tick trade, Ask, and Bid data (nor Level-II data). Auction Dashboard cannot function that way: AD must have access to the streaming market data; and it is not available in a BackTest.

There is workaround to this limitation, which will enable you test your strategies against historical data. It is possible to execute your strategy on the Market Replay connection. (Please notice: as we currently understand, the Replay is not in fact guaranteed to play back every tick exactly in sequence as found in the live feed. Please make further inquiries to NinjaTrader® themselves, relating to the resolution of Replay data during playback: live data recorded for playback with NinjaTrader's "Record for replay" feature may provide tick accuracy.) Without specific knowledge, we can not be sure bid and ask updates would be 100% accurate below a 1-second resolution. Above that, we do expect all other playback to be fully accurate. In order to effect this, you will need to do the following:

Record, or download replay data — level 1 and level 2 — for every day that you wish to test against. (There are tools that allow downloading replay data in bulk: a Google search will yield more than one option, including currently free options. Note that downloaded data is almost guaranteed not to be tick-accurate below 1-second.)

With that, you would be able to connect to the replay, activate your strategy, and start the replay at full speed through the period you wish to test.

Documentation

NinjaTrader's® NinjaScript® editor provides IntelliSense completion and documentation live in the editor. You can get this completion for Auction Dashboard's™ functions.

Please download this XML documentation file:



Move this file to your NinjaTrader 7 / bin / Custom folder;


Additionally: download the following documentation to view in your web browser:

Download this ZIP file:



Extract all of the files in the ZIP archive; and view the index.html file in your web browser.

Scripting Guide

Please view this series of videos to learn how to script against Auction Dashboard™.

Part I

Required info for further parts: custom code and reused code; and how NinjaTrader® handles data.


Part II

Complete custom scripting walk-through with Auction Dashboard™.


Part III

Writing reusable code. Using automatic and custom Ad DataSeries classes.


Example Indicator Using Automatic AdDataSeries

As explained in Part III of the scripting guide, it is simple to create Plots against the pre-defined bar-by-bar AdDataSeries values. The indicator below is a simple example of another implementation:

// We have left NinjaTrader's default using directives in place: using System; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Data; using NinjaTrader.Gui.Chart; // We require AuctionDashboard's NinjaScript interface: using Com.AuctionDashboard.NinjaScript; namespace NinjaTrader.Indicator { /// <summary> /// An example custom indicator that plots one selected AdDataSeriesSource value. /// </summary> [Description("An example custom indicator that plots one selected AdDataSeriesSource value.")] public class AdDataSeriesSource : Indicator { // // NOTICE: // // We must use the fully-qualified name when referring to the // Com.AuctionDashboard.NinjaScript.AdDataSeriesSource enum // --- because it conflicts with our Indicator's name. // /// <summary> /// Used when the user selects Custom. (Static.) /// </summary> private static Com.AuctionDashboard.NinjaScript.AdDataSeriesSource DefaultDataSource = Com.AuctionDashboard.NinjaScript.AdDataSeriesSource.BarVolume; /// <summary> /// AuctionDashboard. /// </summary> private IAd Ad; /// <summary> /// Default value for the DataSource property. /// </summary> private Com.AuctionDashboard.NinjaScript.AdDataSeriesSource dataSource = DefaultDataSource; /// <summary> /// We add our Plot, and optional Zero Line; and create our automatic AdDataSeries. /// </summary> protected override void Initialize() { Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "DataSourcePlot")); if (AddZeroLine) Add(new Line(Color.Gray, 0D, "Zero")); // We don't need to hold a reference to the AdDataSeries (Ad holds it for us). new AdDataSeries(DataSource, this, 0); } /// <summary> /// We need to initialize Ad here. /// </summary> protected override void OnStartUp() { Ad = AdConsumer.OnStartUp(this); } /// <summary> /// We only need to Update Ad: the AdDataSeries will then automatically update. /// </summary> protected override void OnBarUpdate() { if (!Historical) Ad.Update(); } /// <summary> /// (Our Plot.) /// </summary> [Browsable(false)] [XmlIgnore()] public DataSeries DataSourcePlot { get { return Values[0]; } } [Description("The pre-defined AdDataSeriesSource value to plot. Notice that a value of Custom is not supported.")] [GridCategory("Parameters")] public Com.AuctionDashboard.NinjaScript.AdDataSeriesSource DataSource { get { return dataSource; } set { dataSource = (value == Com.AuctionDashboard.NinjaScript.AdDataSeriesSource.Custom) ? DefaultDataSource : value; } } [Description("If true, the indicator will ad an oscilator zero line.")] [GridCategory("Parameters")] public bool AddZeroLine { get; set; } } }

You can download the source code here:

AdDataSeriesSource.cs

Example Indicator Using Back-Fill

To help answer questions about accessing Back-Fill data; we have a short example indicator that hooks into the Back-Fill here:

_Ad_Example_BackFill.cs