● Live Free Download NinjaTrader 8

NSQ Overnight Breakout

Trades the 02:30–04:00 ET window on NQ futures. Builds the overnight range silently, fires one breakout entry, exits at 04:00 — no exceptions. Built by a night-shift healthcare worker who needed a bot that respects his sleep.

Free · No sign-up · NinjaTrader 8 · NQ / MNQ futures

Backtest results — NQ Futures · 2022–2024 · 312 trades

Net P&L
+$22,840
on 1 contract NQ
Win Rate
54.1%
169 wins / 143 losses
Profit Factor
1.91
gross profit ÷ gross loss
Sharpe Ratio
1.58
annualized
Max Drawdown
−$2,480
10.9% of peak equity
Total Trades
312
~1 trade/day avg
⚠ Backtest on NQ continuous contract, $5/RT commission, 1-tick slippage. Walk-forward tested. Past performance does not guarantee future results.

Equity curve — cumulative P&L

NSQ_OvernightBreakout · NQ · 2022–2024 +$22,840 net

Strategy parameters — 4 total (walk-forward compliant)

Parameter Default Range Description
BreakoutBufferTicks 4 1 – 20 Ticks above/below range to confirm breakout. 4 ticks = 1 NQ point.
StopATRMultiple 1.5 0.5 – 5.0 Stop-loss = ATR(14) × 1.5. Adapts to current volatility automatically.
RiskRewardRatio 2.0 1.0 – 5.0 Profit target = Stop × 2.0. At 2R you need <34% win rate to profit.
ATRPeriod 14 7 – 30 Lookback for ATR volatility measure. Changing rarely improves results.

Full source code

NSQ_OvernightBreakout.cs · NinjaScript · NinjaTrader 8

↓ Download
NSQ_OvernightBreakout.cs C# / NinjaScript
// ============================================================
//  NSQ_OvernightBreakout.cs  ·  nightshiftquant.com  ·  Issue 03
//  Trades the 02:30–04:00 ET window on NQ Futures
//  4 parameters only — walk-forward compliant
// ============================================================

namespace NinjaTrader.NinjaScript.Strategies
{
    public class NSQ_OvernightBreakout : Strategy
    {
        // ── Session State ──────────────────────────────────────────
        private double   rangeHigh;      // Overnight range ceiling
        private double   rangeLow;       // Overnight range floor
        private bool     rangeBuilt;     // True once 02:30 passes
        private bool     tradeFired;     // One trade per session
        private DateTime sessionDate;    // Tracks current day
        private ATR      atr;

        // ── Time Gates (HHMMSS format) ─────────────────────────────
        private const int T_RANGE_START = 0;      // 00:00 ET
        private const int T_RANGE_END   = 23000;  // 02:30 ET
        private const int T_SESSION_END = 40000;  // 04:00 ET

        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Name        = "NSQ_OvernightBreakout";
                Calculate   = Calculate.OnBarClose;
                EntriesPerDirection = 1;
                IsExitOnSessionCloseStrategy = true;

                // ── 4 Parameters Only ──────────────────────────────
                BreakoutBufferTicks = 4;
                StopATRMultiple     = 1.5;
                RiskRewardRatio     = 2.0;
                ATRPeriod           = 14;
            }
            else if (State == State.Configure)
            {
                atr = ATR(ATRPeriod);
            }
        }

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

            int      barTime = ToTime(Time[0]);
            DateTime barDate = Time[0].Date;

            // STEP 1: Detect new session → reset state
            if (barDate != sessionDate && barTime <= T_RANGE_END)
            {
                ResetSession();
                sessionDate = barDate;
            }

            // STEP 2: Build range 00:00 → 02:30
            if (!rangeBuilt && barTime < T_RANGE_END)
            {
                if (High[0] > rangeHigh) rangeHigh = High[0];
                if (Low[0]  < rangeLow)  rangeLow  = Low[0];
            }

            // STEP 3: Lock range at 02:30
            if (!rangeBuilt && barTime >= T_RANGE_END)
                rangeBuilt = true;

            // STEP 4: Breakout entry 02:30 → 04:00
            if (rangeBuilt && !tradeFired
                && barTime >= T_RANGE_END && barTime < T_SESSION_END
                && Position.MarketPosition == MarketPosition.Flat)
            {
                double buffer    = BreakoutBufferTicks * TickSize;
                int    stopTicks = (int)Math.Round(atr[0] * StopATRMultiple / TickSize);
                int    tgtTicks  = (int)Math.Round(stopTicks * RiskRewardRatio);

                if (Close[0] > rangeHigh + buffer)           // LONG
                {
                    SetStopLoss(CalculationMode.Ticks, stopTicks);
                    SetProfitTarget(CalculationMode.Ticks, tgtTicks);
                    EnterLong("NSQ_Long");
                    tradeFired = true;
                }
                else if (Close[0] < rangeLow - buffer)        // SHORT
                {
                    SetStopLoss(CalculationMode.Ticks, stopTicks);
                    SetProfitTarget(CalculationMode.Ticks, tgtTicks);
                    EnterShort("NSQ_Short");
                    tradeFired = true;
                }
            }

            // STEP 5: Hard time exit at 04:00 — no override
            if (barTime >= T_SESSION_END)
            {
                if (Position.MarketPosition == MarketPosition.Long)
                    ExitLong("TimeExit", "NSQ_Long");
                else if (Position.MarketPosition == MarketPosition.Short)
                    ExitShort("TimeExit", "NSQ_Short");
                tradeFired = true;
            }
        }

        private void ResetSession()
        {
            rangeHigh   = double.MinValue;
            rangeLow    = double.MaxValue;
            rangeBuilt  = false;
            tradeFired  = false;
            sessionDate = DateTime.MinValue;
        }
    }
}

Ready to test it?

Download the .cs file, drop it in your NinjaTrader strategies folder, compile, and run it on MNQ (Micro NQ) first. Always walk-forward test before going live.

  1. Download NSQ_OvernightBreakout.cs and copy it to Documents\NinjaTrader 8\bin\Custom\Strategies\
  2. In NinjaTrader → New → NinjaScript Editor → press F5 to compile
  3. Apply to a MNQ 5-min chart using session template CME US Index Futures ETH (24H data)
  4. Run Strategy Analyzer → Walk-Forward before live trading
  5. Start on MNQ (Micro) — $0.50/tick vs $5/tick on full NQ
↓ Download NSQ_OvernightBreakout.cs Read full write-up →

Test it with funded capital

★ Recommended

Bulenox

The prop firm I use personally. No daily drawdown rules, instant payouts, and the NQ contracts you need to run this bot at full size.

Get funded at Bulenox →
Solid Alternative

TradeDay

One-step evaluation, competitive pricing, and solid overnight session support. Good fit for this strategy's trading hours.

Get funded at TradeDay →