NinjaTrader custom level indicator

NinjaTrader support and resistance indicator

A support and resistance indicator is a rule for calculating and displaying price levels, not a promise that price will reverse there. NinjaTrader supplies standard indicators and a NinjaScript Editor for custom logic, while Pineify can draft a bounded single-file source artifact for review.

Content checked on

Standard-series rolling support and resistance pattern

Illustrative single-file NinjaScript pattern using ordinary High and Low series. Review naming, warm-up, calculation mode, and drawing behavior in NinjaScript Editor before use.

using System.Windows.Media;
using NinjaTrader.NinjaScript;
using NinjaTrader.NinjaScript.DrawingTools;

namespace NinjaTrader.NinjaScript.Indicators
{
    public class RollingSupportResistance : Indicator
    {
        [NinjaScriptProperty]
        public int Lookback { get; set; }

        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Name = "RollingSupportResistance";
                IsOverlay = true;
                Calculate = Calculate.OnBarClose;
                Lookback = 20;
            }
        }

        protected override void OnBarUpdate()
        {
            if (CurrentBar < Lookback)
                return;

            var support = MIN(Low, Lookback)[0];
            var resistance = MAX(High, Lookback)[0];
            Draw.HorizontalLine(this, "RollingSupport", support, Brushes.SteelBlue);
            Draw.HorizontalLine(this, "RollingResistance", resistance, Brushes.IndianRed);
        }
    }
}

Direct answer

Define the level method first, such as swing highs and lows, pivots, a rolling high and low, or a session range. Then specify lookback, confirmation, reset, plot, and invalidation rules. Pineify can generate one editable NinjaTrader 8 Indicator source file and provide bounded static diagnostics, but it does not verify that a level will hold, predict price, or guarantee a trade outcome.

What to know first

  • Support and resistance are calculated levels whose meaning depends on the chosen method and data.
  • Swing, pivot, rolling-range, and session levels have different timing and repainting considerations.
  • NinjaTrader native compilation and chart review are required after any generated source check.
  • A level can be useful for context without being a reliable signal or a guaranteed reversal point.

Supported scope

What this NinjaScript workflow can cover

  • Swing, pivot, rolling, and session level choices
  • Confirmation and repainting checklist
  • Adjustable lookback and drawing rules
  • Standard-series NinjaScript artifact
  • Native compile and chart validation steps

Choose a level method

Support and resistance can be expressed through prior swing points, pivot calculations, rolling extremes, session highs and lows, or a rule that combines multiple observations. The method determines when a level first appears and whether later bars can change it.

Write the method in measurable terms before requesting code. “Mark important levels” is not enough to decide the lookback, confirmation, price source, or reset time.

  • Swing levels based on confirmed pivots and a stated strength or lookback.
  • Rolling highest and lowest values over an explicit bar count.
  • Session or prior-period levels with a defined exchange time zone.
  • Pivot levels with a formula and a rule for the active period.

Make timing and repainting explicit

A level based on future bars can appear clean in hindsight but be unavailable at the time of a signal. Confirm whether a swing is plotted only after the required bars have closed, and state whether historical levels remain fixed or can be replaced by newer levels.

NinjaTrader supports calculations on bar close, each tick, or price change for indicator instances. The calculation mode and lookback guard should be part of the specification and the review record.

Add the parameters that explain the chart

Useful parameters include strength, lookback, maximum level count, minimum distance, session template, line style, and whether a level extends until touched or invalidated. Avoid exposing a setting that is not connected to a defined calculation.

Keep plots and drawing objects identifiable. A label should state whether it is a prior high, prior low, pivot, or a calculated zone, so later testing does not confuse different methods.

A checkable source pattern

The artifact below is a compact standard-series pattern for two rolling levels. It is intentionally simple: the actual method, drawing IDs, and warm-up behavior still need review and native compilation in NinjaScript Editor.

Validate the level before using it

Compile the source in NinjaTrader, place it on the intended symbol and timeframe, and inspect the first bars where the level becomes available. Compare historical and real-time behavior around session boundaries, gaps, contract changes, and thin data.

Use a level as one input in a documented plan. A clean compile or attractive chart does not establish predictive power, execution quality, or profitability.

Sources and verification

Last verified:

Pineify provides information and code-generation assistance, not investment advice. Generated code, static checks, backtests, simulations, and historical examples cannot predict prices or guarantee returns. Review all code and test it in NinjaTrader Editor, Strategy Analyzer, and a simulation account before considering live use.

Frequently asked questions

Describe the level formula

State the support and resistance method, lookback, confirmation, session reset, and drawing rules. Pineify generates one editable NinjaTrader 8 Indicator source file for review.