Risk Disclosure

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View full risk disclosure.

Error Messages and NinjaScript Requirements


Please note, SharkIndicators does not provide any NinjaScript, programming, or coding support.
This information is provided to assist you in your communication with the author of the indicator causing the issue or NinjaTrader support.  Whomever is more pertinent in helping with the issue.

This page provides a list of some coding issues a 3rd party indicator may have, and causing errors with BloodHound or BlackBird.  NinjaTrader is forgiving when running an indicator on a chart, but is very strict when running an indicator inside another indicator (i.e. using an indicator in BloodHound).



Error Messages from BloodHound

MaximumBarsLookBack.TwoHundredFiftySix

Image

If you recieved this error, an indicator you are using has the MaximumBarsLookBack setting internally locked.  NinjaTrader 8 throws an error when validating that indicator’s historical data.  The setting is  MaximumBarsLookBack.TwoHundredFiftySixNinjaTrader documentation link.

Ask the programmer to remove all references to  MaximumBarsLookBack.TwoHundredFiftySix, or change all MaximumBarsLookBack.TwoHundredFiftySix to MaximumBarsLookBack.Infinite  Either solution will remove the limitation and error.

// SEARCH FOR ALL INSTANCES OF THIS TEXT //
MaximumBarsLookBack.TwoHundredFiftySix;

// CHANGE THEM TO //
MaximumBarsLookBack.Infinite;

This is a NinjaTrader 8 issue.  When indicator data is being validated, using .IsValidDataPoint(x), NinjaTrader 8 throws an error instead of stating the data is invalid.  NT 7 did not have this issue.


Other Error Messages

DevExpress… is not a Visual or Visual3D

Image

This error is benign. It is caused by a NinjaScript Add On that summons a list of objects and invokes those elements as a Visual object.

The NinjaAddons.ShortcutToolbar Add On is known to cause this error.

Example of offending code
VirtualizingStackPanel verticalStackPanel = null;
foreach (var v in chartGrid.Children)
     if ( v is VirtualizingStackPanel   &&
            // VirtualizingStackPanel is a Visual element
           (v as VirtualizingStackPanel).Uid == "ShortCutToolbar")
     {
          verticalStackPanel = v as VirtualizingStackPanel;
          break;
     }




Developing for BloodHound

NT8 NinjaScript Requirements & Limitations

These are common coding mistakes and bad practices that can cause errors.

Series<T>   Initializing and Synchronizing

A Series<T> can cause the following errors and other similar errors;

System.IndexOutOfRangeException:
System.ArgumentOutOfRangeException:
System.NullReferenceException:

When calling an indicator from another indicator (i.e. using an indicator inside BloodHound) strict NinjaScript protocols must be followed.  The following guidelines can eliminate those errors.

Initializing
All Series<T> must be initialize in the OnStateChanged() » State.DataLoaded section of your code, in accordance with Series<T> NinjaScript documentation.  Initializing anywhere else can cause errors when BloodHound tries to access the Series.

Synchronizing
Do not synchronize a Series<T> to a secondary Bars series.
E.G.  myData = new Series<double>(this, BarArray[1], MaximumBarsLookBack.Infinite);
Do not specify a BarsArray.  Allow the Series to sync to the primary Bars series.

Setting Values
BarsInProgress:  If the indicator uses multiple Bars series (multi-timeframes), only set values to the Series during BarsInProgress zero.  Setting values in any other Bars series can cause  System.ArgumentOutOfRangeException:  errors.

Example
protected override void OnBarUpdate()
{
  if(BarsInProgress == 0)
  {
               //  Set values during this Bars series
   mySeries[0] = Close[0];
  }
}

OnBarUpdate():  A public Series<T> must be set in OnBarUpdate().  Setting a public Series<> in other methods may create a synchronization issue.  Per NinjaTrader's best practices, BloodHound calls guest indicator data during the OnBarUpdate() event.  This is a timing issue with NinjaTrader's event driven methods.

OnMarketData():  A public Series<T> should not be set in this method.  BloodHound uses OnBarUpdate() to access indicator values.  Guest indicator that set a public Series<> in OnMarketData() return a null value.  Values gained from OnMarketData() should be stored and set to public Series<> in OnBarUpdate().

Calculations in OnRender()

NinjaTrader does not call the OnRender() method when an indicator is called by another indicator, as is the case when using an indicator in BloodHound.  OnRender() is only called when the indicator is running on a chart.  Make sure no data is calculated in this method that is used for Plot values or Series<T> values.  Therefore, perform calculations for visual purposes only in this method.

ChartControl  Properties

The ChartControl object is Null when an indicator is called by another indicator, as is the case when using an indicator in BloodHound.  Make sure ChartControl properties are not required for the calculation of data (i.e. Plots or public Series<T>) that BloodHound will use.



NinjaScript Indicator Tester


This is an indicator "wrapper" that creates the same environment as using an indicator in BloodHound.   This wrapper is intented to help indicator developer debug their indicators by visually seeing, on the chart, the data that BloodHound/BlackBird is receiving.  NinjaTrader is forgiving when running an indicator on a chart, but is very strict when running an indicator inside another indicator.
Instructions on how to use this wrapper are written within the code.  Open this indicator using the NinjaScript Editor to read.  Knowledge of NinjaScript programming is required.

Please Note: SharkIndicators does NOT provide any type of programming help or support in any form!  If you need assistance, you should contact a NinjaScript programmer, or the author of the indicator you are trying to test, or NinjaTrader support for general NinjaScript help.

Import into NinjaTrader 8 using the standard .zip file import process.
Click to download, IndicatorTesterForBloodHound_NT8.zip