Lorentzian Classifier Indicator for NinjaTrader 8

Created 19 Sep 2025 · Updated 27 Feb 2026

The Lorentzian Classifier indicator for NinjaTrader 8 is a Free indicator that provides bullish/bearish signals based on a machine learning classification model.

Prerequisites

To properly use this indicator you should have the following prerequisites available.


Description

This classification model is built on the Lorentzian distance measure to find similarities between features extracted from a block of price bars. The Lorentzian distance is a special type of distance measure able to classify features in a multi-dimensional space — a novel way to implement Nearest-Neighbour algorithms. By using it, the indicator can find similar blocks of price action in historical training data and infer the next bar's outcome from a vote among the most similar historical features.

Here are the steps the indicator executes to predict the next price action outcome and attribute a score to that prediction:

  • Consider a period of bars to analyze — a Prediction Period parameter sets how many of the most recent bars are used, and this sliding window progresses as new bars close.
  • Extract features from those bars — not based on any indicator values, but on context-based Time, Price, and Volume values.
  • Use the Lorentzian distance algorithm to find the most similar features among the training data loaded when the indicator is initialized.
  • Take a number of the most similar samples — the count can be set manually via Voting Count, or determined automatically (via a clustering algorithm) when Voting Count is 0.
  • Let those samples vote on the outcome — each votes whether the next candle will be bullish or bearish — and average the result into a predicted price movement, in points, for the next N candles.

Examples

Example 1: MES on the 1-Minute Timeframe

The indicator's simplest usage scenario, running on MES (Micro ES, the S&P 500) on the 1-minute timeframe, with a threshold value of 5 filtering out any signal scoring below 5 — leaving only high-probability signals, drawn as green arrows for bullish and red arrows for bearish. This example uses the RTH session (09:30-16:30 EST); time of day has a big impact on signal quality since the classification algorithm is context-based on price, time, and volume, and MES/US futures volume is much higher during RTH than during ETH (extended trading hours).

Lorentzian classifier example 1: MES on 1-minute timeframe
Click to enlarge
Example 2: MES on the 1-Minute Timeframe

With the same parameters, more signal arrows appear — some of good quality, some irrelevant (e.g. a green bullish arrow drawn during a bearish downtrend). Low-quality signals can usually be dismissed by checking the very next bar after the signal, while some signals do successfully predict a genuine change of market regime and trend.

Lorentzian classifier example 2: MES on 1-minute timeframe
Click to enlarge
Example 3: Composite Signal — a Range Based on Two Consecutive Signals

The indicator can produce a more complex composite signal from a sequence of two consecutive arrow signals close to each other and forming an increasing (bullish) or decreasing (bearish) price action — defining a price range that can be traded as a breakout entry setup, both on the bullish and bearish side.

Lorentzian classifier example 3: Composite signal with range
Click to enlarge

Parameters

We always try to keep the parameters to a minimum.

License
LicenseThis is the free license key you get when you create an account on automated-trading.ch. After creating an account, copy your license key from the billing page. You need to set this parameter only once per month. This indicator is totally free to use, but you need to register for a free account and license to use it.
General
Data FolderThe path to the folder where you should download and place the training data files (see the Installation section below).
Prediction PeriodSets the number of lookback bars used for inference. Default value 15; can be modified to experiment with other values.
Enable on Extended Trading HoursEnables/disables running prediction during the ETH (extended trading hours) interval 18:00-09:30 EST — useful if you only want to trade during RTH.
Signal Threshold (Points)Minimum predicted price movement (0 to any positive number) required to generate a signal. The higher this value, the fewer signals produced.
Prediction Candle ShiftShifts which candle the prediction outcome is evaluated against.
Voting CountThe number of similar historical samples used to calculate the score of the next bars' outcome. Default value 0, which makes the indicator automatically decide the sample count via a clustering algorithm; any other value (e.g. 20) fixes the indicator to always take that many samples.
Render
Show Signal ArrowEnables/disables drawing a signal arrow when a signal is generated.
Show Score TextEnables/disables drawing the signal's prediction score when a signal is generated.
Score Text SizeFont size of the Score Text, if drawn.
Draw Opacity (1-100)Opacity of the indicator's drawings.
Arrow Bullish Color / Arrow Bearish ColorColor used to draw bullish/bearish arrow signals.
Show Sequence SignalShows the composite signal of two consecutive arrow signals as a range rectangle.
Sequence Rectangle Bullish Color / Bearish ColorColor used to draw bullish/bearish range rectangles.
Sound Alert
Play Sound AlertEnables/disables playing a sound when a signal is generated.
Play Sound FileSets which .wav file is played on the sound alert.

Download & Installation Instructions

License Requirements

At automated-trading.ch you can choose to either purchase a monthly subscription to use our premium products, or use our free products without subscribing.

In both cases, you need to create an account so you can get a License you can use for both premium and free products.

To obtain your license, simply sign up and then get your license on the billing page.

Important: This is a Free product — no paid subscription is required to run it live, though creating an account is still required to get your license.
Download
Sign in to download this file.
Latest Version v2.1.0.0 · Published 7 months ago
This file was downloaded 219 times. Last download was 1 day ago.

You can also download this strategy — and every other automated-trading.ch strategy or indicator — anytime from your centralized Downloads page.

Installation Steps
1
Download the per-instrument training data files (one archive per instrument family, e.g. MES/ES, MNQ/NQ, MYM/YM, M2K/RTY, MCL/CL, MGC/GC) into a folder of your choice. Do not extract these files; this folder is what you'll set in the indicator's Data Folder parameter.
2
Import the downloaded .zip file into NinjaTrader using the Import NinjaScript menu item.
3
Open a new chart window.
4
Right-click the chart and choose Indicators... to add the indicator to the chart, pasting your license (found on the billing page) as you do.
5
After adding the indicator to the chart, it runs on the chart's historical data first, then continues to run on live market data.

Frequently Asked Questions

General

Yes — if you have an idea that you believe can improve this indicator, use the contact page to send us a message.

No, the source code of the indicator is protected for copyright reasons.

No, this indicator only does rendering and doesn't provide data that can be used from within a strategy — check out our other strategies for one based on this same concept.

Yes, you can use this indicator without TickReplay, but bear in mind that in this case the indicator will not detect events on historical candles — it will only start detecting them on real-time volume and price data.

Release Notes

  • Added New composite signal: sequence signal

  • Added New parameter: Prediction Candle Shift; Change of prediction algorithm; Updated Training Data to 30 January 2025

  • Fixed Bug: Indicator didn't work on Real time prices; Better prediction results with improved algorithm; Showing indicator progress on Ninjascript output window

  • First Release of the indicator
discord
Join our Discord community
Questions, feedback, or just want to chat with other traders? Come say hi.
Join Discord
Quick Facts
Platform NinjaTrader 8
Category Indicator
Plan Required Free
Latest Version v2.1.0.0
Last Updated 7 months ago
Downloads 219