Importing a strategy from GSB to NinjaTrader
Importing a strategy from GSB to NinjaTrader
This guide applies to NinjaTrader version 8.0.19.1 64-bit
A big thank you for Jason T for his work on these docs and GSB Ninja Trader.
After you have built and your systems in GSB, select a system you want to export from GSB and import to NinjaTrader 8.
Click on the Scripts tab and select NinjaTrader 8
Copy the ID to use as the NT8 strategy name
Open NinjaScript Editor
In the Control Center left click New > NinjaScript Editor
Add a strategy. Click on the ‘+’ sign at the bottom of the editor to add a New Strategy
The New Strategy dialog box will appear.
Click Next >
In the Name field paste the system ID. Ninja will remove spaces, dashes etc. The name must start with a letter so prefix it with something like “GSB”.
Click Generate
The NinaScript editor will generate a strategy template.
Remove pre-generated NinjasScript strategy code. Click on the background. Select all text by using CTRL-A. Delete all text using Delete or Backspace.
Return to GSB.
Right click on the Script background and select Copy to Clipboard
Return to the NinjaScript editor, right click and paste the code into the strategy or use CTRL-V.
In the top menu bar left click on the Compile icon.
In the lower left corner, the compile animation will play until the strategy is compiled. The animation will cease and, an audio confirmation will be played.
Open a NinjaTrader chart. From the Control Center, select New > Chart
On the chart in the top menu bar click on Data Series icon.
Add the correct data series to match the data that you built your GSB systems in, noting the Data Series (Type and Value) and Time frame.
Under Time frame select Custom Range then match Start Date, End Date and Trading Hours (ie session template) to your GSB data series.
If you want to see the trades plotted in the chart after you apply a strategy then under Trades, select Plot executions: Text and marker or Markers only.
Left click OK and wait for the chart to load.
At the top of the chart left click the Strategies icon.
Left click to select the strategy you wish to add from the top left Available window.
Then at the bottom of the lower left Configured window left click add and the strategy will appear in the Configured list. Do not click OK yet.
The Properties fields in the right-hand side will active for the strategy you just added.
Under Set up select the Account you want to trade the strategy on. For back-testing the Sim101 account is fine. For live trading select a live account that you’ve already added to NinjaTrader.
Ensure the Enabled check box is ticked.
Leave Historical fill processing: Order fill resolution as Standard. GSB entries are not intra-bar and so high-resolution fills are not required.
If you added slippage to your settings when building systems in GSB add that to Slippage here.
In Order handling tick the check box for Exit on session close if you built systems using Exits > MOC (Market on Close): True.
The default Exit on session close seconds default is 30. NinjaTrader will close trades 30 seconds before the end of the session. Modify this if you wish.
Now left click OK.
If you get this dialog box, click OK.
If active, the GSB strategy name will appear in the top left corner of the chart.
If your forgot to enable the strategy the strategy name will be prefixed by “(D)”. If this occurs click the Strategies icon, left click to tick the Enable check box and click OK again.
Using the horizontal slider at the bottom of the chart, slide left and right through the time series to see the trade entries and exits.
If you go to the Strategies tab on your Control Center, you will see the strategy listed there. You can enable and disable the strategy from here. You can also add, edit and remove strategies from here. The Control Center is a good place to monitor multiple strategies without the need to also have multiple charts up and running consuming resources. You can just add strategies to the Control Center instead of adding them to the chart first if you prefer.
You can set up different Workspaces to easily switch between a minimal Control Center only strategy monitor or a screen full of charts with all your strategies on it. This is a standard NinjaTrader function, so see NinjaTrader help for how to do this.
Historical strategy performance can be seen by right clicking on a chart with a strategy enable on it, or on a strategy in the Control Centre, and selecting Strategy Performance > {the strategy name} > Historical.
The performance report will be shown and you can work through the options to display data and compare it to the same data from GSB.
Summary is equivalent to Performance in GSB. Analysis shows similar information to Graphs as well as Trades.
Under Analysis, selecting Period > Trades is the same as Graphs > Trade Number in GSB and Periods > Daily is the same as Graphs > Trade Date.