Black Friday, until December 2: FONDEOREAL gives 30% off the 50K, 20% off the 100K and 10% off the 150K at FTMO Futures. See the offer →

Lab · November 2026 · 3 min read

Pine Script to NinjaTrader 8: What Changes

How to convert a TradingView strategy to NinjaScript: repainting, request.security(), fills and costs, based on the official documentation.

You can, but translating the code isn't enough. Pine Script and NinjaScript fill orders, process bars and apply costs differently, so the same system can give different results. Before you trust the conversion, compare the trades one by one.

What to checkPine ScriptNinjaTrader 8
When it calculatesAt the bar close by defaultOnBarClose by default; always at the close on historical data
When it fillsAt the next bar's open by defaultDepends on the order type and the fill model
Adding entriespyramiding is 1EntriesPerDirection is 1
CostsNo commission and 0 ticks of slippage by defaultYou set them up in your test
Session endNo automatic exit from this featureExit on session close is on by default
On this page
  1. The biggest risk: repainting
  2. Watch out for request.security()
  3. Non-standard charts
  4. How to convert it properly
  5. Sources

The biggest risk: repainting

TradingView calls repainting a script behaving differently on historical and realtime bars. On an open bar, the high, low and close aren't fixed yet, so a cross can appear and vanish. If your strategy does that, the conversion copies a signal your chart shows in a misleading way.

Watch out for request.security()

It's one of the causes that changes results most. In real time it can return unconfirmed values, and with lookahead it can read future data on historical bars. If your backtest uses another timeframe that way, its numbers can look too good. Fix that before you convert.

Non-standard charts

TradingView warns that on charts such as Heikin Ashi or Renko, results don't reflect actual market conditions by default. If your strategy was built there, test the logic on standard bars first.

How to convert it properly

  1. Write the rules in plain sentences: entry, exit, stop, schedule and size.
  2. Check the Pine code for repainting, request.security() or non-standard charts.
  3. Set realistic commission and slippage on both sides.
  4. Use the same instrument, period, session and timeframe.
  5. Compare trades one by one before you look at profit.
  6. Test in simulation and review why a backtest can differ from live.

If it's for a prop firm account, check the rules before coding. Some firms ban automated strategies, and others set specific conditions. See your firm's rules before you pay for a conversion.

Want us to convert it? We move your Pine Script strategy to NinjaScript and check that every entry and exit follows your rules. Simple conversions from $150.

Get a free quote

Sources

Keep reading

Practise an evaluation, freeAll 91 articles →

Free: The Other Half Workbook. Nine templates for trading with a cool head: your one-page plan, the pre-session checklist, the twelve-patterns test, your size and the bill for your mistakes.

Get the free workbook

Get ready for 2027: the Trader Planner. Each day's US releases in New York time, your pre-market routine and a log for every session.

Paperback on Amazon, $16.99 Get the PDF, $9

Educational content based on the official TradingView and NinjaTrader documentation. Not investment advice. Backtest results are hypothetical. TradingView and NinjaTrader are trademarks of their owners.