NinjaScript that behaves the same in sim as it does live.
We build NinjaTrader strategies and indicators the disciplined way: risk and defaults set once in the lifecycle, logic that only runs on a closed bar, and a stop attached to every entry. Then we forward-test on simulated fills before a cent is funded, because the most expensive bugs are the ones you find live.
The strategy, in real NinjaScript.
No black box. Defaults and risk are set once in the lifecycle, the logic runs on a closed bar so it can't repaint, orders are gated to Realtime, and the stop and target attach the moment the position opens, never as a second step.
1protected override void OnStateChange()2{3 if (State == State.SetDefaults)4 {5 Name = "EsBreakout";6 Calculate = Calculate.OnBarClose; // closed bars only, no repaint7 StopTicks = 32;8 TargetTicks = 48; // 2:3 risk / reward9 }10}1112protected override void OnBarUpdate()13{14 if (State != State.Realtime) return; // no orders during replay15 if (CurrentBar < Lookback) return;1617 if (Close[0] > MAX(High, Lookback)[1])18 {19 EnterLong("long");20 SetStopLoss("long", CalculationMode.Ticks, StopTicks, false);21 SetProfitTarget("long", CalculationMode.Ticks, TargetTicks);22 }23}Orders fire in Realtime, not in replay.
As the strategy replays history to warm up, it keeps seeing signals. The disciplined build holds them until State reaches Realtime. Drop that one check and it places phantom orders into the replay, and your backtest quietly stops matching live. Toggle the check and watch the order log.
Backtest, then sim, then live.
The most expensive bugs are the ones you find with real money. NinjaTrader makes it easy to forward-test on simulated fills first, so we do, every time, before a cent is at risk.
Backtest across history with realistic costs, to see if the logic ever had an edge.
Forward-test in real time on simulated fills. Same code, live data, no money at risk.
Go live small, confirm the sim and reality agree, then size up. Never the other way round.
We build the strategy exactly as specified, and forward-test it before you fund it.
What we won't do is hand you a green backtest and call it a guarantee. A NinjaScript strategy is a precise, tireless executor of your rules. Whether those rules make money is decided by the market, not by how cleanly they're coded. We make the code clean and the testing honest. The edge is yours to bring.
NinjaScript that behaves the same in sim as it does live.
Closed-bar logic so it doesn't repaint, orders gated to Realtime, a stop attached to every entry, and forward-testing on simulated fills before a cent is funded.