NinjaTrader Integration Guide

    Take a GSB system into NinjaTrader 8, check it matches GSB, test it in simulation, then go live

    Prefer to watch? This page has video lessons

    Module 6: Going Live · Training Hub · free with a GSB Pro account

    Create your free account to watch the videos →

    What you need
    • A system in GSB that you've walked forward and are happy with (see Step 0)
    • Ideally, a system built on price data exported from NinjaTrader, the platform you'll trade on. How to export it: Uploading Data to GSB
    • NinjaTrader 8 with a data connection, and the one-time setup done: GSB AddOn compiled, Central Time, Merge back adjusted, a Trading Hours template
    • A note of your system's details from GSB: its ID, bar size, start and end dates, session, slippage and whether it uses MOC exits. You'll match each one in NinjaTrader
    NinjaTrader support status
    • Since GSB 77.46 (2 September 2026), NinjaTrader 8 is fully supported and out of beta. GSB's full indicator and filter library works for NinjaTrader 8, and Custom Indicator export writes NinjaTrader scripts too.
    • 77.46 also corrected how GSB simulates NinjaTrader's order handling (entries, stops, targets, reversals and session-close exits) and fixed several NinjaTrader indicator calculations, so results now match TradeStation and MultiCharts. This applies to systems built or re-optimised in 77.46 or later; systems saved earlier keep the results they were built with, so re-optimise them.
    • NinjaTrader strategies from 77.46 check that your computer's time zone matches your price data before they run, and stop with a message if it doesn't.
    • On an older build? Update to 77.46 or later before exporting to NinjaTrader.
    Which version? Trademaid's NinjaTrader guides, which these steps follow, were written for NinjaTrader 8.0.19.1 (64-bit), and the GSB screenshots are from GSB 1.0.56 (2019). NinjaTrader 8.1 and newer GSB builds may label some buttons differently. If something doesn't match your screen, check Trademaid's current help and NinjaTrader's own help. Thank you to Jason T for his work on Trademaid's NinjaTrader docs and GSB's NinjaTrader integration.
    The short version
    1. Choose a walked-forward system in GSB (Step 0)
    2. One-time: import and compile the GSB AddOn, set Central Time, Merge back adjusted, Trading Hours
    3. GSB Scripts tab → NinjaTrader8 → copy the system ID
    4. NinjaTrader New → NinjaScript Editor → + → Next > → name it GSB + ID → Generate
    5. Delete the template code, paste GSB's code (right-click → Copy to Clipboard in GSB) → Compile
    6. New → Chart → Data Series: match bar size, Custom range dates and Trading hours
    7. Strategies icon → add the strategy → Sim101, Enabled, Standard, slippage, Exit on session close → OK
    8. Right-click the chart → Strategy Performance → your strategy → Historical: does it match GSB?
    9. Simulate on Sim101 for at least two weeks, then go live small
    10. Check it every day, and keep reconciling with GSB
    Risk. This is general education, not trading advice. Live trading carries real risk, and you can lose money. GSB and NinjaTrader backtests are hypothetical: past results don't guarantee future performance. Never trade money you can't afford to lose.

    Step 0: Choose a system worth deploying

    Be selective before you export anything. Trademaid's advice:

    1. First find the setup (session time, entry mode and secondary filter) with the best out-of-sample statistics.
    2. Then look at the top system of the first few families.
    3. Walk each candidate forward. The brown out-of-sample curve must hold up against the other curves. See Walk-Forward Optimization.
    4. Allow for slippage and commission. If you built without them, a flat-looking curve only gets flatter once you add them.

    More on picking: Selecting Systems.

    One-time setup in NinjaTrader

    Do this once per computer, before your first system. The click-by-click steps are on Uploading Data to GSB (NinjaTrader 8, One-time setup), because you need the same setup to export data. Here's what each setting is for.

    SettingWhereSet toWhy
    GSB AddOn (LibGSB)Control Center: Tools → Import → NinjaScript Add On, pick the newest file, then compile LibGSB in the NinjaScript EditorImported and compiledIt's the function library GSB systems need. Without it, GSB strategies won't compile
    Time ZoneTools → Options → General → Preferences → Time ZoneCentral Time (US & Canada)Keeps NinjaTrader on the same time zone as GSB and TradeStation. You don't need to change your PC's clock
    Global merge policyTools → Options → Market Data → Historical → Global merge policyMerge back adjustedYou can't autotrade a continuous futures contract live, so NinjaTrader joins older contracts onto the current one
    Trading Hours templateTools → Trading Hours → addOne per GSB session, for example 0830_1500: Monday to Friday, 08:30 AM to 03:00 PM, End of Day (EOD) tickedNinjaTrader's version of a session template. It must match the session you built on in GSB
    Global Simulation ModeControl Center: Tools → Global Simulation ModeOn (ticked) while testing. Off only when you're ready to go liveA safety catch: while it's ticked, every order stays in simulation and nothing goes to your broker
    • Get the latest GSB and the NinjaScript AddOn through the Resource Manager first. When importing, sorting by Date modified helps you pick the newest file.
    • If NinjaTrader asks to save the workspace when you restart after the import and you're unsure, Trademaid suggests Yes to all.
    • The AddOn only works once it's compiled: New → NinjaScript Editor, double-click AddOns, double-click LibGSB, click Compile.
    Make a habit of checking Global Simulation Mode

    In the Control Center, click Tools. A tick to the left of Global Simulation Mode means it's on. While it's on, every order stays in simulation, which is what you want while testing. Once you go live, it's easy to leave it on by mistake and keep trading in simulation without noticing. Check it every time before you enable strategies.

    Step 1: In GSB, open the system's NinjaTrader script

    1. In GSB, click your system's row in the Unique Systems tab (or the Walk-Forward tab).
    2. Check its equity curve on the Graphs tab one last time.
    3. Click the Scripts tab.
    4. Open the drop-down at the top and choose the line ending in NinjaTrader8. If you've walked the system forward, choose the one ending in NinjaTrader8 / WF: Trademaid says the walk-forward settings should be better than the original optimisation settings.
    5. Read the comment lines at the top of the script. They record the system's ID (for example 20191129-193756-636342-P4hEE), its Price Data file and session, MaxBarsBack: 500, the trading dates and the slippage. Note them down.
    6. Select the ID and copy it (Ctrl+C). It becomes the strategy's name in NinjaTrader.
    GSB with a system selected in Unique Systems and its equity curve on the Graphs tab

    Select the system and check its curve on the Graphs tab (GSB 1.0.56)

    GSB Scripts tab with the drop-down open, showing TradeStation, MultiCharts and NinjaTrader8 (Beta) versions

    Scripts tab: choose the NinjaTrader8 line in the drop-down. Walked-forward systems also list a NinjaTrader8 / WF line

    Step 2: Create a new strategy in the NinjaScript Editor

    1. In the NinjaTrader Control Center, click New → NinjaScript Editor.
    NinjaTrader Control Center New menu with NinjaScript Editor highlighted

    Control Center: New → NinjaScript Editor

    1. Click the + sign at the bottom left of the editor to add a new strategy.
    Empty NinjaScript Editor with the plus sign at the bottom and LibGSB listed under AddOns

    The + sign is at the bottom left. LibGSB under AddOns shows the GSB AddOn is installed

    1. The New Strategy window opens. Click Next >.
    New Strategy wizard welcome page with the Next button

    New Strategy: click Next >

    1. In Name, paste the system ID. NinjaTrader removes the spaces and dashes.
    2. The name must start with a letter, so type GSB in front. For example, GSB20191129193756636342P4hEE.
    3. Click Generate.
    New Strategy wizard General page with the name GSB20191129193756636342P4hEE

    Paste the ID, put GSB in front, then click Generate

    Step 3: Replace the template with GSB's code

    NinjaTrader generates a strategy template. You don't need any of it.

    1. Click on the background of the code, press Ctrl+A to select everything, then press Delete. The editor is now empty.
    2. Go back to GSB's Scripts tab (still on the NinjaTrader8 line).
    3. Right-click the script background and choose Copy to Clipboard.
    4. Go back to the NinjaScript Editor. Right-click and paste, or press Ctrl+V.
    NinjaScript Editor showing the generated template code for the new GSB strategy

    The generated template: select all of it and delete it

    GSB Scripts tab on the NinjaTrader8 script with the right-click Copy to Clipboard menu

    In GSB: right-click the script → Copy to Clipboard

    Newer GSB builds may show different right-click items. Trademaid's later help shows Copy for match check, Copy for live trading and Copy Selected. From 77.46 there are also Save for Match Check As and Save for Live Trading As, which save the NinjaTrader strategy file straight into your NinjaTrader 8 Strategies folder, and a batch Match-Check menu on the Optimization Results grid for saving many systems' NinjaTrader scripts at once. Trademaid hasn't published screenshots of these yet.

    Step 4: Compile

    1. Click the Compile icon in the editor's top toolbar.
    2. An animation plays in the lower left corner. When it stops, a sound plays. That means it has compiled.
    3. Your strategy now appears under Strategies in the NinjaScript Explorer on the right. Close the editor.
    NinjaScript Editor with GSB code pasted and the Compile toolbar button showing its tooltip

    GSB's code pasted in. Click Compile in the top toolbar

    Bottom of the NinjaScript Editor where the compile animation plays

    The compile animation plays at the bottom left, then a sound plays

    Compile errors? See Troubleshooting below.

    Step 5: Open a chart that matches your GSB data

    If any of these differ from GSB, the results won't reconcile.

    1. In the Control Center, click New → Chart.
    2. Click the Data Series icon in the chart's toolbar.
    3. Fill in the settings in the table below, then click OK and wait for the chart to load.
    NinjaTrader Control Center New menu with Chart highlighted

    Control Center: New → Chart

    Chart toolbar with the Data Series icon tooltip

    The Data Series icon in the chart toolbar

    Data Series settingSet toIn Trademaid's example
    InstrumentThe market you built on, for example ESES 12-19
    Type and ValueYour GSB bar size, for example Minute and 30Minute, 30
    Load data based on (under Time frame)Custom rangeCustom range
    Start date and End dateThe same dates as your GSB data01/01/2000 to 29/11/2019
    Trading hoursThe template that matches your GSB session0830_1500
    Plot executions (under Trades)Text and marker or Markers only, if you want to see the tradesText and marker
    Data Series window with Minute 30, Custom range, start and end dates and Trading hours 0830_1500

    Type, Value, Custom range, dates and Trading hours

    Data Series window scrolled down to Trades, with Plot executions set to Text and marker

    Optional: Trades → Plot executions

    Step 6: Add the strategy and set its properties

    1. Click the Strategies icon in the chart's toolbar.
    2. In the Available list (top left), click your strategy.
    3. Click add at the bottom of the Configured list. The strategy moves into Configured and its properties appear on the right.
    4. Don't click OK yet. Set the properties in the table below first.
    5. Click OK. If an Order Confirmation message appears, click OK.
    Chart toolbar with the Strategies icon tooltip

    The Strategies icon in the chart toolbar

    Strategies window with the GSB strategy in the Available list and the add button below Configured

    Click your strategy in Available, then add

    PropertyUse thisIn Trademaid's screenshot
    AccountSim101 for testing. A live account (already added to NinjaTrader) only when you go liveSim101
    EnabledTickedTicked
    Order fill resolutionStandard (leave it). GSB entries aren't intra-bar, so high-resolution fills aren't neededStandard (Fastest)
    SlippageThe same slippage you used in GSB. 0 if you built without slippage0
    Exit on session closeTick it if you built the system with Exits → MOC (Market on Close): TrueTicked
    Exit on session close secondsDefault 30: NinjaTrader closes trades 30 seconds before the session ends. Change it only if you need to30
    Calculate, Start behavior, Entries per direction, Maximum bars look back, Bars required to tradeTrademaid's guide doesn't ask you to change these. Leave them as they appearOn bar close, Wait until flat, 1, 256, 500
    Strategies window with the GSB strategy configured: Sim101, Enabled ticked, Standard (Fastest), slippage 0, Exit on session close ticked, 30 seconds

    Properties set for testing: Sim101, Enabled, Standard (Fastest), slippage 0, Exit on session close, 30 seconds

    Not confirmed yet: whether Maximum bars look back should stay at 256 or be changed, and whether GSB's exported code sets these values itself. (The GSB script header says MaxBarsBack: 500, and Trademaid says bars back must be 500 in TradeStation and MultiCharts.) If NinjaTrader doesn't reconcile with GSB, this is one of the things to check. Check Trademaid's current help.
    Order Confirmation message saying strategy orders are submitted without confirmation

    If this message appears, click OK

    Step 7: Check the strategy is running

    • When the strategy is active, its name shows at the top left of the chart.
    • If the name has (D) in front, it's disabled and won't trade. Click the Strategies icon, tick Enabled and click OK again.
    • Use the scroll bar at the bottom of the chart to slide through history and see the entries and exits.
    Chart with the GSB strategy name at the top left

    Running: the name shows at the top left

    Chart with (D) in front of the GSB strategy name

    (D) in front means disabled

    NinjaTrader chart with the GSB strategy's long and short entries and session-close exits plotted

    Trades plotted on the chart: entries, and Exit on session close

    Step 8: Reconcile with GSB

    Before any simulation, check that NinjaTrader's backtest reproduces GSB's.

    1. Right-click the chart (or the strategy in the Control Center's Strategies tab).
    2. Choose Strategy Performance → your strategy → Historical.
    3. The report opens on Summary. Over exactly the same dates, compare net profit, drawdown and number of trades with GSB.
    4. To compare trade by trade, use the views in the table below.
    Chart right-click menu with Strategy Performance, the strategy name and Historical highlighted

    Right-click → Strategy Performance → your strategy → Historical

    In NinjaTrader's reportSame as in GSB
    SummaryPerformance tab
    Analysis → Period → TradesGraphs → Trade Number
    Analysis → Periods → DailyGraphs → Trade Date
    NinjaTrader Strategy Performance Summary with total net profit, max drawdown and total number of trades

    Summary: compare net profit, max. drawdown and total # of trades with GSB. Note commission is $0 in this example. Hypothetical results only

    Results don't match? Check these first

    Small differences are normal. Big ones mean something in the setup is different. Don't go further until you've found it.

    • Data Series: same Type, Value, start date, end date and Trading hours template
    • Time zone Central Time (US & Canada) and Global merge policy Merge back adjusted
    • Same slippage and commission. Exit on session close ticked if you built with MOC exits
    • The latest GSB AddOn, imported and compiled
    • Same price data: prices differ between platforms, even for the same market and bar size. Build on NinjaTrader data if you'll trade NinjaTrader
    • Volume-based indicators (such as accumulation/distribution): the common NinjaTrader data feeds don't carry historical up and down volume, so systems that lean on volume (many Nasdaq systems, for example) lose a little in NinjaTrader. Build on the data feed you'll trade

    Step 9: Trade it in simulation first

    • Leave the strategy on the Sim101 account, with Global Simulation Mode on, and let it run in real time.
    • Simulate for at least two weeks (our guideline, lesson 23). Longer is fine.
    • Check each simulated trade matches what GSB would have done, and note the fills you get.

    Step 10: Go live, small

    1. Only when the backtest reconciles and the simulation behaves as expected.
    2. Open the strategy's properties again (Strategies icon on the chart, or edit it from the Control Center's Strategies tab) and set Account to your live account. It must already be added to NinjaTrader.
    3. Make sure Enabled is ticked, and click OK.
    4. Click Tools in the Control Center and make sure Global Simulation Mode is off (no tick next to it). While it's ticked, the strategy can't place live trades.
    5. Start small. Peter Zwag's observation is that traders who over-leverage do not survive. Watch the first live trades closely.

    Monitoring once you're live

    Expect the brown line, not the best line. Trademaid expects real-time trading to look more like the walk-forward out-of-sample (brown) curve than the original backtest. Judge live results against that.

    What can go wrong: systems can and do fail out of sample, real slippage may be higher than you assumed, overnight gaps can push trades past stops and targets, and simple slips happen (a disabled strategy, the wrong account, a lost connection).

    Daily check (two minutes)

    1. Open the Control Center's Strategies tab. Each row shows the instrument, data series, position, account, connection and whether it's enabled. It's a good place to watch several strategies without lots of charts open.
    2. Check every strategy is Enabled, on the right Account, and connected. On a chart, no (D) before the name.
    3. Check Tools → Global Simulation Mode is off for live strategies.
    4. Glance at the Log tab for errors or warnings.
    NinjaTrader Control Center Strategies tab listing the GSB strategy with instrument, data series, account Sim101, connection and Enabled

    Control Center → Strategies tab: enable, disable, add and edit strategies here

    Tip: NinjaTrader Workspaces let you switch between a minimal Control Center-only monitor and a screen of charts. See NinjaTrader's help for how.

    Every so often

    • Re-run Strategy Performance → Historical on the latest dates and compare with GSB, trade by trade (Analysis → Period → Trades against GSB's Graphs → Trade Number).
    • Keep a note of the slippage and commission you actually pay, and compare them with what you assumed in GSB. Investigate any mismatch straight away.
    • To track several systems together, get them into Portfolio Analyst Pro: in GSB, right-click the system and save it, with Export To Portfolio Analyst set to True in the Save Systems window. Its Market Performance report shows each system's recent results. Check Trademaid's current help for the latest way to do this.

    Guardrails

    • Keep size modest. In one of Trademaid's portfolio examples, no system is allowed more than one contract, because systems can and do fail.
    • Write your review rules down before you go live, so you're not making them up during a drawdown. Judge drawdowns against the walk-forward history.
    • Trademaid normally wouldn't trade several systems from the same family live.
    • Review every system, not just the winners, to avoid survival bias.

    How often to re-optimise: rarely. Peter Zwag's view is that GSB systems don't need frequent re-optimisation, and that an anchored walk-forward suits them.

    Not confirmed yet: a specific rule from Trademaid for when to stop trading a system. Trademaid's help has an article on how often trading systems need re-optimising. Check Trademaid's current help.

    Deployment checklist

    Go down the list. Every row must pass before real money is at risk.

    CheckWherePass when
    System chosenGSBWalked forward, brown out-of-sample curve holds up, slippage and commission allowed for
    One-time setup doneNinjaTrader Tools menuAddOn compiled, Central Time, Merge back adjusted, Trading Hours template made
    Strategy compilesNinjaScript EditorNo errors, and the compile sound plays
    Chart matches GSBData SeriesSame instrument, Type, Value, Custom range dates and Trading hours
    Properties match GSBStrategies dialogSim101, Enabled, Standard fills, same slippage, Exit on session close if MOC
    Strategy is runningTop left of the chartStrategy name shows, with no (D) in front
    Backtest reconcilesStrategy Performance → HistoricalNet profit, drawdown and number of trades close to GSB over the same dates
    Simulation doneSim101 accountAt least two weeks, trades behaving as expected
    Ready for liveStrategies dialog and Tools menuLive account selected, Global Simulation Mode off (no tick), small size
    Monitoring routineControl Center Strategies and Log tabsDaily check written down, review rules decided in advance
    Before you enable a live account
    • NinjaTrader's historical backtest reconciles with GSB over the same dates (net profit, drawdown, number of trades)
    • Slippage and commission match what you used in GSB
    • The strategy has run on Sim101 for at least two weeks
    • Global Simulation Mode is off (no tick) for live trading
    • You're starting small and not over-leveraging

    GSB results are hypothetical backtests. Past or hypothetical results don't guarantee future performance.

    Troubleshooting

    Compile errors

    • Make sure the GSB AddOn (LibGSB) was imported and compiled before you add GSB strategies
    • Use the most recent AddOn file from the Resource Manager download (sorting by Date modified helps)
    • Make sure the strategy name starts with a letter (put GSB in front of the ID)
    • Make sure you deleted all of the template code and pasted the whole GSB script
    • Read the NinjaScript Editor's error messages for the line numbers
    • GSB's NinjaScript names the library version it needs, in a line such as int GSB_Scripts_Version = LibGSB.GSB_Scripts_2023_10_18;. An error like "type X does not exist in LibGSB" means your AddOn is older than the code. Import the matching or newer GSB_NinjaScript_yyyy_mm_dd AddOn from C:\GSB\Supplementary Scripts (TS & MC) (older builds: C:\GSB\GSB (Managers)\NinjaTrader8 Code\), then compile LibGSB again

    Strategy name starts with "(D)"

    The strategy isn't enabled. Click the Strategies icon, tick Enabled and click OK again.

    Results very different from GSB

    Work through Results don't match? Check these first.

    No live trades, but no errors

    Check Global Simulation Mode, the Account (still Sim101?), Enabled, and the connection in the Strategies tab.

    GSB Price Data Exporter gives an error

    The data file is usually open in another program. Close it, and close the NinjaTrader chart running the exporter, then export again.

    Next steps

    Need to export data from NinjaTrader to build on? See Uploading Data to GSB. Still stuck? See the troubleshooting guide or contact support.

    GSB's main tools are its genetic algorithm search, its walk-forward and robustness tests and its export to TradeStation, MultiCharts and NinjaTrader. New to it? See what Genetic System Builder does and how GSB compares with StrategyQuant and Build Alpha.