Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Clearing Trades/Orders database in running time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Clearing Trades/Orders database in running time

    Hello,

    I’m using Market Replay to backtest 10 or more strategies at once, I want to backtest several years of data using several virtual machines in parallel in order to go faster than the 500% max speed, but the performance of NinjaTrader 7 decreases a lot when it has processed some thousands of trades, and the backtest slows down dramatically.

    I’am exporting the trade list in a CSV file via StreamWriter, so I don’t need the statistics of Ninjatrader.

    The question is:
    Can I clear all the processed trades that are inside the Ninjatrader database with something like this pseudocode below or something similar during the backtest?

    Code:
    Performance.AllTrades.ClearAllTrades
    My solution right now is rewinding a few seconds using “Go To” in the Market Replay Player every once in a while, this clears all the orders inside the database, but this is not a very efficient method at all.

    Thanks.

    #2
    Hello Grankus,

    The Performance.AllTrades a collection list that you could use .Clear() for this.

    However, I would advise against this as it will cause referencing errors in the strategy once cleared. The reason for this is that the Strategy Analyzer will use the Performance information to draw upon the results. If you clear this collection it can have adverse affects on the back test it self
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much! I'll try it.

      I take note of the errors. Nevertheless I only use this method in realtime backtests, not in the Strategy Analyzer.

      Bye!

      Comment


        #4
        The Performance.AllTrades a collection list that you could use .Clear() for this.
        Hi,

        Ok, this doesn’t work as I expected…

        The effect that I’m looking for it’s similar to what this code below can do, but without deleting the active running real-time strategies (in Strategies tab):

        Code:
        Account.SimulationReset(true);
        Or similar to when I use “Go To” or the slider of the Replay window.

        I mean, I want to delete/reset all in Orders (in orders tab), Executions, and Account Performance, what I think it’s causing the progressive slowing down in realtime backtests.

        Comment


          #5
          Hello,

          You are correct resetting the simulator account does remove the strategies from the control center and charts this is the expected behavior.

          There are not really any methods to do what you are asking because the platform was not designed to clear trade history while an active strategy is running, that would be why there is no supported method for this.

          You can reset the simulator account before you start the strategy to start with 0 orders and then continue, that would be the only supported method of running a strategy and also having the trade history cleared.

          Please let me know if I may be of further assistance.

          Comment


            #6
            Ok! Thank you for your help

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            65 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            41 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            23 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            26 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            52 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X