Sourcetable Integration

Export NinjaTrader trades to CSV

Jump to


    Welcome to our comprehensive guide on how to export NinjaTrader trades to a CSV fileā€”an invaluable resource for traders looking to enhance their analysis and strategy development. NinjaTrader, a powerful trading platform, allows users to meticulously track and manage their trades, but the true potential is unlocked when these trades are exported into a CSV file and dissected within a spreadsheet environment. This analysis not only offers insights into past strategies but also aids in sharing information seamlessly. Here, we will delve into the specifics of NinjaTrader trades, the step-by-step process of exporting to CSV, practical applications of this data, an alternative method using Sourcetable for those seeking more advanced analysis tools, and a helpful Q&A section for common inquiries about the export process. Whether you are a seasoned trader or new to the platform, this page will equip you with the knowledge to leverage your trade data to its fullest potential.

    Exporting NinjaTrader Trades to a CSV File

    Utilizing the Cbi.Trade Object for Export

    The Cbi.Trade object is integral to exporting trade data to a CSV file. It encapsulates all necessary information that one would need to save trade details effectively. However, it is important to note that this method of exporting trades to a CSV file is only applicable during backtesting scenarios.

    Adding Logging to Strategy

    To capture trade executions accurately, it is advised to implement logging directly within the strategy that executes the trades. This ensures that every trade made by the strategy is recorded in real-time. The OnExecutionUpdate event is particularly useful for this purpose, as it signals when trade executions occur.

    Determining the Timing of Order Fills

    For those needing to log the precise moment an order is filled, both the OnBarUpdate and OnExecutionUpdate events can be harnessed. These events will help in capturing the exact timing of order fulfillment, which can then be included in the CSV export.

    Using the TradesExporter Indicator

    The generation of the CSV file is facilitated by the TradesExporter indicator. This tool is specifically designed for this task and is readily available to the NinjaTrader community. By utilizing the TradesExporter, users can streamline the process of exporting their trades to a CSV format for further analysis or record-keeping.

    Sourcetable Integration

    Streamline Your Trading Data with Sourcetable

    For traders utilizing NinjaTrader, managing and analyzing your trades just became more efficient with Sourcetable. Instead of the multi-step process of exporting trades to a CSV file and then importing them into a separate spreadsheet program, Sourcetable offers a seamless integration. With the ability to sync live data from various apps and databases, including NinjaTrader, Sourcetable automates the data consolidation process directly into a user-friendly spreadsheet interface.

    By choosing Sourcetable, you bypass the tedious export and import cycle, saving you valuable time. Sourcetable's real-time data syncing capability means your trading information is always up-to-date, providing you with instant insights for faster decision-making. Embrace the power of automation and enhance your business intelligence with Sourcetable, a smarter approach to managing your NinjaTrader trades.

    Common Use Cases

    • N
      Sourcetable Integration
      Use case 1: Analyzing individual trade performance post-backtest
    • N
      Sourcetable Integration
      Use case 2: Aggregating strategy results for comparison with other strategies
    • N
      Sourcetable Integration
      Use case 3: Assessing the robustness of a strategy by exporting data for external stress testing
    • N
      Sourcetable Integration
      Use case 4: Sharing trade data with collaborators or consultants for independent review

    Frequently Asked Questions

    How can I export trades from NinjaTrader to a CSV file?

    To export trades to CSV, right-click on any Control Center tab or Trade Performance grid, select 'Export...', and then choose 'Excel' to save the file in CSV format.

    What data format is used when exporting trades to Excel from NinjaTrader?

    The data is exported with the format: date/time, quantity, profit loss, trade ID.

    Can I automate the export of trades from NinjaTrader?

    Yes, you can use custom NinjaScript or third-party tools like AutoIt to automatically run the export process.

    Is it possible to generate trade reports automatically in NinjaTrader?

    Yes, you can create custom NinjaScript to generate reports automatically and output the data to a text file, which can then be imported into Excel.

    Can I use StreamWriter for exporting trade data from NinjaTrader?

    Yes, the StreamWriter function can be used to write the trade data to a text file, which can then be imported into Excel.


    In summary, NinjaTrader offers several methods to export trade data for further analysis and record-keeping. You can conveniently export your Trade Performance grid to Excel with a simple right-click and select Export function, or utilize the streamwriter function to output trade data to a text file. For those who prefer automation, external programs like AutoIt can be employed to run the Trade Performance report automatically, and the built-in NinjaScript can be used to export every trade automatically. However, for a more seamless integration of your trading data into a spreadsheet, consider using Sourcetable, which allows you to import data directly without the need for CSV exports. Sign up for Sourcetable today to streamline your trade data management and enhance your trading analysis.

    Start working with Live Data

    Analyze data, automate reports and create live dashboards
    for all your business applications, without code. Get unlimited access free for 14 days.