TradingView → NinjaTrader 8 Strategy Ports
Pine Script strategies and indicators rebuilt as NinjaScript for NQ futures, including a premarket-range breakout with unmanaged OCO orders, a VWAP trend strategy and a colour-matched oscillator.
The problem
The client had strategies that worked on TradingView and wanted to run them live on NinjaTrader 8 for NQ and MNQ futures. The NT8 versions had to match the TradingView behaviour closely enough that trade lists could be compared side by side.
What I built
- Premarket breakout strategy (unmanaged orders):
- the premarket range sets OCO stop entries a set number of points above the high and below the low
- a stop plus three scaled take-profits
- breakeven after the first target
- the stop is resized to the remaining quantity after every partial fill
- Extended breakout version:
- pullback limit entries as an alternative to stop entries
- a VWAP bias with a buffer
- re-entry only after the level resets
- max loss per trade and per day in dollars
- VWAP trend strategy:
- higher-timeframe MA filter on a second data series
- VWAP with two band multipliers
- ATR stop clamped between minimum and maximum ticks, plus a tick trailing stop
- loss-streak pause, bar spacing between entries and a session filter
- Oscillator indicator and strategy: a SuperSmoother filter, fast and slow MAs, a signal line and HSV/tanh colour mapping, rebuilt plot by plot to match the Pine visuals. The strategy adds tick-based SL/TP, breakeven, separate long and short trailing, daily loss limits and a close before session end.
- Debug tooling: logging limited to a chosen time window, for tracing single trades.
Details
- Brackets are built from order-update events as fills arrive, so a partial fill never leaves contracts without a stop.
- If the broker rejects a stop, the strategy sends a market “safety close” straight away rather than leave the position unprotected.
- TradingView strategy-tester exports were used as the reference trade list to check the NT8 ports for parity.
- A timezone-offset input was replaced by the chart’s own session time.