NinjaTrader_Josh
01-15-2008, 03:27 AM
Reference sample for NinjaTrader 6.5.XXXX.X or greater.
There may be cases where you want to have your indicator calculate non-plotted values that you will want to access from other indicators or strategies.
We suggest using any available class that implements the IDataSeries interface. These include the following:
BoolSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/boolseries_class.htm)
DataSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/dataseries_class.htm)
DateTimeSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/datetimeseries_class.htm)
FloatSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/floatseries_class.htm)
IntSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/intseries_class.htm)
StringSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/stringseries_class.htm)
Using these classes will provide you with a way to store calculated values associated to each bar in a chart. This will allow any referencing objects to access the historical calculated values. These classes hold internal logic that ensure that the OnBarUpdate() method of the indicator is processed prior to accessing the current bar’s value. This guarantees you will receive up-to-date values when retrieving the calculations.
In the event that an IDataSeries type class does not exist for the object type you wish to expose, you will need to use the Update() method within the property “getter” to ensure that OnBarUpdate() is processed and your calculated value is up-to-date.
The attached reference sample demonstrates the following concepts:
Creating exposed BoolSeries objects
Storing and retrieving values from BoolSeries objects
Important methods and properties include:
BoolSeries class (http://www.ninjatrader.com/support/helpGuides/nt7/boolseries_class.htm)
Set()
Update() (http://www.ninjatrader.com/support/helpGuides/nt7/update.htm)
Other methods and properties of interest include:
BackColor (http://www.ninjatrader.com/support/helpGuides/nt7/backcolor.htm)
Reset()
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
NOTE: There is an indicator and a strategy in the attached file used to demonstrate this concept. Please be sure to review both files.
There may be cases where you want to have your indicator calculate non-plotted values that you will want to access from other indicators or strategies.
We suggest using any available class that implements the IDataSeries interface. These include the following:
BoolSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/boolseries_class.htm)
DataSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/dataseries_class.htm)
DateTimeSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/datetimeseries_class.htm)
FloatSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/floatseries_class.htm)
IntSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/intseries_class.htm)
StringSeries Class (http://www.ninjatrader.com/support/helpGuides/nt7/stringseries_class.htm)
Using these classes will provide you with a way to store calculated values associated to each bar in a chart. This will allow any referencing objects to access the historical calculated values. These classes hold internal logic that ensure that the OnBarUpdate() method of the indicator is processed prior to accessing the current bar’s value. This guarantees you will receive up-to-date values when retrieving the calculations.
In the event that an IDataSeries type class does not exist for the object type you wish to expose, you will need to use the Update() method within the property “getter” to ensure that OnBarUpdate() is processed and your calculated value is up-to-date.
The attached reference sample demonstrates the following concepts:
Creating exposed BoolSeries objects
Storing and retrieving values from BoolSeries objects
Important methods and properties include:
BoolSeries class (http://www.ninjatrader.com/support/helpGuides/nt7/boolseries_class.htm)
Set()
Update() (http://www.ninjatrader.com/support/helpGuides/nt7/update.htm)
Other methods and properties of interest include:
BackColor (http://www.ninjatrader.com/support/helpGuides/nt7/backcolor.htm)
Reset()
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
NOTE: There is an indicator and a strategy in the attached file used to demonstrate this concept. Please be sure to review both files.