Welcome to Using Deep Signal Indicators. The Deep Signal Library can show where your machine learning model would enter a long or short trade on a chart by using the Deep Signal Indicator. A machine learning model needs to be created before using this feature. For help with creating a new machine learning model please see Creating a Machine Learning Model. 

The first step is to make sure the existing strategies and indicators will compile. From the NinjaTrader Control Center, click on the menu item New -> NinjaScript Editor. When the NinjaScript Editor window opens we need to compile the strategies and indicators. Press F5 or click on the Compile button.

The Deep Signal indicator files are in the NinjaScript Editor under the Indicators/DST folder.

  • DSTPredictIndicatorBase is the base indicator NinjaScript file for viewing the trade entries for your machine learning model. Please do not modify this file as it will be the base file for any new Deep Signal Indicator file you create. 
  • DSTPredictIndicatorMomentum is derived from DSTPredictIndicatorBase and can be modified to suit your needs or can be used as an example for creating a new Deep Signal Indicator.
  • DSTPredictIndicatorTest is derived from DSTPredictIndicatorBase and can be modified to suit your needs or can be used as an example for creating a new Deep Signal Indicator.

We'll use the DSTPredictIndicatorMomentum indicator file. If we click on the DSTPredictIndicatorMomentum indicator in the NinjaScript Editor window, the window will show the contents of the indicator file. We'll go over each of the numbered areas below.

  1. All Deep Signal Indicators need to be derived from DSTIndicatorBase. The Using section needs to include DST.Library as well.
  2. Each derived indicator from DSTPredictIndicatorBase must override the OnStateChange method and call base.OnStateChange.
  3. The AddDSTIndicator method is used to add indicator data to the machine learning model. This method is used in both creating a new model or using an existing model to predict long or short signals. The AddDSTIndicator data for the prediction indicator must match the same data that was used to create the machine learning model. If you used AddDSTIndicator method such as AddDSTIndicator(MACD(1, 26, 9).Diff, "MACD Diff", 4) then you will need to add it in the prediction indicator in the same order as well. This method is where you can add whatever indicator data you would like to use in the machine learning model. As an example, if you wanted to add a moving average of the primary instrument, you could add AddDSTIndicator(SMA(20), "SMA-20", 2). This will add the Simple Moving Average of the primary instrument with a period of 20, indicator name is "SMA-20" and all data fed to the machine learning model will be rounded to 2 decimals.
  4. Each derived indicator from DSTPredictIndicatorBase must override the OnBarUpdate method and call base.OnBarUpdate.

To display where the Deep Signal model would enter a trade, first we need to open a chart and add the indicator. From the Control Center, go to the New -> Chart menu item and select which instrument you would like on the chart.

For this example we are using e-mini S&P with continuous contracts ES ##-##.

The next step is to add the Deep Signal Indicator. Either right click in the chart, and select Indicators or click on the Indicators button at the top of the chart.

From the Indicators window, please choose the DSTPredictIndicatorMomentum indicator and click on add.

Once the indicator has been added, you'll need to choose the machine learning model you would like to use. Select the Strategy Data Folder dropdown button and choose a machine learning model that has been created. If you haven't created a machine learning model for the DSTCreateMomentumModelTest strategy you will need to do that before you can select a model.

Once you have selected a model then click on OK. The chart will display colored lines that represent where the model would predict a long or short trade. The long trades are represented by a green bar and a short trade is represented by an Indian Red bar. The colors are changeable by selecting the Go Long Brush or Go Short Brush dropdown menu.

You can now create new models and see where the model would predict a long or short trade. Depending on your model you may see where there are multiple long or short entries in a row. This is may be normal for the particular model if it finds multiple trade entries.

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.