Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90


Trade Station vs Ninja Trader

  • Filter
  • Time
  • Show
Clear All
new posts

    Trade Station vs Ninja Trader

    How can I use the same data to back-test my code back-test from TradeStation to Ninja Trader or vice versa? The problem is my code is the same but my results are different? How can I make sure my new Ninja trader code is executing the same as my trader station code?

    Export the bar data from TradeStation and import it into NinjaTrader as a symbol - for instance, if it's a minute-bar strategy, you could export 1-minute data from TS for ES as TS_ES, and then import it into NinjaTrader as a new futures symbol TS_ES, then build any kind of minute bars from that knowing that the merges, holidays, etc. are all the same as on TS.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey


      Hello RMin101,

      Thanks for your post.

      As a general rule for backtesting: Same Input data + Same strategy code and parameters = Same results. If there is different data being used then you will likely have different backtest results.

      You could consider following QuantKey_Bruce's advice to export your TradeStation historical data and import it into NinjaTrader to use for backtests.

      See the help guide documentation about importing historical data.

      Importing Historical Data:
      Brandon H.NinjaTrader Customer Service


        I am trying to export TS data and import it into NT 8, but I get errors because the formats are slightly different.. Any ideas how I make the formats the same, so that NT doesn't give errors? I could write a Python script, but I would think someone already created a solution for this.


        20231106 060100;4378;4378.5;4377.75;4378.5;127
        20231106 060200;4378.25;4378.25;4378;4378;42

        TS (has an additional column for open interest, different datetime formats and different delimiters)


        Thanks in advance,


          To convert the TradeStation (TS) data format to the NinjaTrader 8 (NT 8) format, you can use a Python script. The script will do the following:

          1. Read the TS data.
          2. Convert the date and time format from `MM/DD/YYYY,HH:mm` to `YYYYMMDD HHmmss`.
          3. Remove the open interest column.
          4. Adjust the delimiter from a comma to a semicolon.
          5. Write the transformed data in the NT 8 format.

          Here's the Python script that accomplishes this:

          import pandas as pd
          from datetime import datetime

          def convert_ts_to_nt(ts_file, nt_file):
          # Read the TS data
          ts_data = pd.read_csv(ts_file, header=None)
          ts_data.columns = ['Date', 'Time', 'Open', 'High', 'Low', 'Close', 'Volume', 'OpenInterest']

          # Process each row
          nt_data = []
          for index, row in ts_data.iterrows():
          # Convert date and time format
          date_time_str = f"{row['Date']} {row['Time']}"
          date_time_obj = datetime.strptime(date_time_str, '%m/%d/%Y %H:%M')
          formatted_date_time = date_time_obj.strftime('%Y%m%d %H%M%S')

          # Format the row according to NT format
          formatted_row = f"{formatted_date_time};{row['Open']};{row['High']};{row['Low']};{row['Close']};{row['Volume']}"

          # Write the NT data to a file
          with open(nt_file, 'w') as f:
          for line in nt_data:
          f.write(line + '\n')

          # Example usage
          convert_ts_to_nt('ts_data.csv', 'nt_converted_data.csv')

          The script reads the TS data from a CSV file. Then it iterates through each row, converting the date and time to the required format and removing the open interest column. Then each row is formatted according to the NT 8 format and written to a new file.


            I really appreciate this. I was hoping there are built in features in TS or NT that allowed for changing the data formats. Someone does mention EL scripts that handled import/export conversions between the two formats in this thread at NexusFi

            Ymcapital ​- regardless of my wishful thinking, I do appreciate this code! Many thanks!


              You can do that in the newest version of Excel as well since Python is built into Excel now if that's easier.

              NT is pretty selective about the format of the data that will work. It's not a common format (from what I've seen). I've bought data from different vendors before and I almost always have to reformat the data for NT which is a pain in the butt.


              Latest Posts


              Topics Statistics Last Post
              Started by GodAtum, Today, 09:52 AM
              8 responses
              Last Post GodAtum
              by GodAtum
              Started by WHICKED, 06-27-2023, 12:07 PM
              83 responses
              1 like
              Last Post NinjaTrader_ChelseaB  
              Started by Rxxar, Today, 09:56 AM
              1 response
              Last Post NinjaTrader_Clayton  
              Started by catinabag, Today, 08:56 AM
              3 responses
              Last Post NinjaTrader_Gaby  
              Started by flonkle, Today, 01:19 AM
              3 responses
              Last Post flonkle
              by flonkle