Using Multiple Machine Learning Models in a Single NinjaTrader Strategy


How to combine predictive signals with Deep Signal Library for smarter trades

One of the most powerful features of the Deep Signal™ Library is the ability to use multiple machine learning models within a single NinjaTrader strategy. This opens up a range of possibilities—like blending momentum signals with confirmation indicators, or stacking long-term and short-term models for more dynamic decision-making.

In this article, we’ll walk you through how to implement and visualize two predictive models side-by-side in your strategy using the Deep Signal Library.

 

🧠 Step 1: Create Two Separate Models

Before combining models, you need to create each machine learning model independently. In our example, we’ll be working with:

  • DSTCreateModelTest
  • DSTCreateMomentumModelTest

Each of these models is trained using a different strategy setup. Make sure the indicator data used in each model creation matches the data that will be used for prediction later.

 

🛠 Step 2: Load the Multi-Model Strategy

After the models are created, open the DSTUsingTwoModelsStrategy file in the NinjaScript Editor. This strategy uses two Deep Signal indicators:

  • DSTPredictIndicatorMomentum
  • DSTPredictIndicatorTest

Each one loads its respective model and outputs trade predictions via signals (GoLongSignal and GoShortSignal).

You can modify the input indicators using the AddDSTIndicator method. Just make sure the indicators match those used during model training—consistency is key.

 

⚙️ Step 3: Connect Models to the Strategy

In the strategy code, you’ll see both indicators set up with user-defined data folders:

DSTPredictIndicatorMomentum(_LogMessagesStr, _BaseFolder, ..., _MomentumDataFolder, ...)

DSTPredictIndicatorTest(_LogMessagesStr, _BaseFolder, ..., _TestDataFolder, ...)

When you apply the strategy in NinjaTrader, you’ll set these folder paths to match the models you created earlier.

 

📈 Step 4: Execute the Strategy

Within the OnBarUpdate() method, the strategy checks for long or short signals from both models:

if (DSTPredictMomentum.GoLongSignal[0] > 0)

    EnterLong(..., "Long Momentum"); 

if (DSTPredictTest.GoLongSignal[0] > 0)

    EnterLong(..., "Long Test");

Each signal outputs a 1 (enter trade) or 0 (no trade) for the current bar [0]. You can also access signals from previous bars by using [1], [2], etc.

 

🎨 Step 5: Visualize It On a Chart

Once your strategy is added to a chart, set the Go Long Brush and Go Short Brush colors for each model. For example:

  • Indian Red bars = short signals from the Momentum model
  • Coral bars = entries from the Test model

Seeing both signal types on the same chart makes it easy to analyze overlap, filter out noise, and debug any entry behavior.

 

Final Tips

  • Make sure each indicator is tied to the correct model folder path.
  • Be consistent with the indicators used during training and prediction.
  • Add extra chart indicators if you want to test filters or entry conditions.
  • Use the Strategy Analyzer to backtest each model’s contribution independently or together.

Using multiple models in a single strategy gives you layered insight and more control over your trade decisions. Whether you’re stacking momentum with confirmation, or diversifying signal logic, the Deep Signal Library makes it easy to scale your strategy intelligence.

👉 Want to try this yourself? Fire up NinjaTrader, build your models, and deploy your custom multi-model strategy today.