Trading Router
Contact Us Log in Sign up

NinjaTrader 7 Setup

1. Download TradingRouter Strategy

On Downloads page, download the latest version of NinjaTrader 7 TradingRouter Strategy

2. Import Strategy into NinjaTrader 7

  1. On NinjaTrader 7, click File => Utilities => Import NinjaScript... (See picture below)
  2. If there is a pop up window asking for "Do you wish to continue?", click ok(See picture below)
  3. In the popped window, choose the downloaded NinjaTrader 7 Strategy (See picture below)
  4. Then a message box will show that import is successful (See picture below)

3. Connect your NinjaTrader 7 to a broker

You have to connect to a broker before running a strategy.

  • Click File => Connect, then choose your broker. You can choose Simulated Data Feed for testing.

4. Edit your trading symbols file

You have to let TradingRouter Strategy know all the symbols you want to trade by adding the symbols in the file symbols.txt. If a symbol is not in the file symbols.txt, any commands related to the symbol will not be executed. The symbol of the chart on which TradingRouter Strategy is running does not need to be in the file symbols.txt, but we still recommend you put it in. For example, if you run TradingRouter Strategy on EURUSD chart, then EURUSD does not need to be put in the file symbols.txt, but we still recommend you put EURUSD in the file symbols.txt in case you run TradingRouter Strategy on different chart at different time.

  1. Create a folder TradingRouter in your NinjaTrader 7 document folder (See picture below). Usually your NinjaTrader 7 document folder is "C:\Users\username\Documents\NinjaTrader 7". When you load TradingTrouter Strategy to chart, the TradingTrouter Strategy will show the path of the file symbols.txt in the Log (See picture below) and will also give warning in the Log if the file symbols.txt is not found. (See picture below)
  2. Create a text file named symbols.txt in TradingRouter folder. (See picture below)
  3. Put all the symbols you want to trade into symbols.txt, symbols are seperated by "," and you can use multiple lines. (See picture below)
  4. The symbols must be exactly the same as the symbols in your NinjaTrader 7. For example if the symbols of your NinjaTrader 7 start with a prefix "$", you must include this prefix in your symbols in the file symbols.txt like "$EURUSD, $GBPUSD".

5. Load TradingRouter Strategy on chart

  1. Click File => New => Chart... (See picture below)
  2. On the poppped up window, double click any symbol to move the symbol to the bottom panel, choose "Day" for Type and 1 for Value under Period, that is we use any one day chart, then click OK. (See picture below)
  3. Right click on the chart and choose Strategies... on the popped window (See picture below)
  4. In the popped up Strategies window, double click TradingRouter Strategy to make it in the bottom panel (See picture below)
  5. Input Trading Router Client Token and set Enabled to True, then click OK. (See picture below) You can go to NinjaTrader 7 Strategy Settings to see more about the settings on the TradingRouter Strategy.
  6. You can get your Trading Router Client Token from your dashboard of Trading Router website (See picture below)
  7. Click OK on the popped up Order Confirmation window (See picture below)
  8. Then the strategy is running. If there are words "Strategy is active" on chart, it measn the strategy status is ok. You can also check the version of the strategy on the chart. (See picture below)
  9. Now you can send messages to your NinjaTrader 7 to execute trades

6. Trouble Shooting

  1. If the Strategy does not show "Strategy is active" on chart when you load the strategy to chart, you can check if you have connected to a broker (see 3. Connect your NinjaTrader 7 to a broker) and if you have enabled the strategy (See this picture).

    You can also check if the chart type is one day chart.

  2. If the Log shows "The strategy TradingRouterStrategy_Nt7_xxxxxxx has called the Add() method with an invalid instrument....." it means some symbols in the file symbols.txt is not a valid symbol, the Log message itself will tell you which symbol is not valid. For example, the picture below says "AUDUSD does not exist in the Instrument Manager", it means AUDUSD is not a valid symbol for your broker, maybe the correct symbol is "$AUDUSD".

  3. If the strategy shows "ES0002: Cannot start script! Reason: cannot Register" on chart (See picture below), you can check if you have input the correct client token and check on the TradingRouter website to see if your service is stopped.

  4. You can use your Trading Router dashboard to send a simple test message to check if the Trading Router Strategy can receive the message (Go to Test Alert to learn how to send test messages). For exmpale, you can send "token=masterxxxxxxx, n_signal=buy, n_symbol=EURUSD, n_qty=1", If the log shows Received Message "SIGNAL=BUY|N_QTY=1|N_SYMBOL=$EURUSD|" (See picture below), it means the connection to Trading Router server is ok and the Trading Router Strategy can receive the message.

If Trading Router Strategy receives the test message but NinjaTrader 7 does not execute the command, you can check the following things

  1. Check if your Strategy is within active hours. The Strategy shows texts on chart to indicate if it is within active hours (See picture below). The default active hours is from 00:00 to 24:00, it is all the time. See NinjaTrader 7 Strategy Settings, Miscellaneous Settings to learn how to change active hours.

  2. If the log shows "Message is ignored because strategy is halted" (See picture below), it means you have sent a eaoff command before to deactive the Trading Router Strategy, you need send eaon command to reactive the Trading Router Strategy

  3. If the log shows "Error: Unknown signal", it means the you have not send a correct signal. For example if you send "token=masterxxxxxxxx, n_signal=bu, n_symbol=EURUSD, n_qty=1", you can get a message on log "Error: Unknown signal BU", because bu is not s correct signal. (See picture below)

  4. If the log shows "No n_symbol in Ninja message!", it means the n_symbol field is required in your command but you don't have this n_symbol field in your command. (See picture below)

  5. If the log shows "No n_qty in Ninja message!", it means the n_qty field is required in your command but you don't have this n_qty field in your command.(See picture below)

  6. If the log shows "The symbol $AUDUSD is not in symbols.txt.", it means you have not put the $AUDUSD in the file symbols.txt. (See picture below)

  7. If the log shows "No n_price parameter in Ninja message!", it means you need one of n_price_pips, n_price_pct, n_price_exact in your message. Command for pending orders need this. (See picture below)

  8. If the log shows "n_symbol is not the chart symbol!", it means the n_symbol field in your closeall message is not the chart symbol on which the Strategy is running. It is the safety measure of closeall and closealleaoff message. (See close all) For example, you run your Trading Router Strategy on chart EUSUSD, but you send closeall commmand with n_symbol=GBPUSD, then the n_symbol in your command is not the same as the chart symbol. (See picture below)

7. Check Strategy status

When Strategy is running, it shows texts on chart, you can check the Strategy status from these texts. The beginning of these texts shows the Strategy version and if the Strategy is active