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


Dumping / Re-setting Data

  • Filter
  • Time
  • Show
Clear All
new posts

    Dumping / Re-setting Data

    I often work with a fair amount of price data (years worth). This often maxes out the available memory. If I then change the "Time frame" on the "Strategy Analyzer" the platform hangs, causing me to exit the platform, then re-launch.

    So, is there a way to remove the price data that has been put into RAM (ie, dumping the data that's been loaded there) -- other than to exit the platform, then re-launch?

    Hello spottysallrite,

    There isn't any supported way to clear the memory.

    Is this just a backtest or is this an optimization?

    Does this script use the SystemPerformance collection within the code?

    Is IncludeTradeHistoryInBacktest set to true or false?

    Does the script have a large amount inputs (public variables)?

    What version of NinjaTrader 8 are you using? (Help -> About)

    Can this behavior be reproduced when testing over just a few days of data and then changing the time frame?
    Chelsea B.NinjaTrader Customer Service


      Well, this is mostly for optimizations, but happens with backtests. (Indeed, I use backtest to set up for optimizations.) The script uses "SystemPerformance", but in a very limited way (it's inside a bool, which I have turned off most of the time, especially during optimizations). How would that affect compute resources? Seems it would be just very limited in the memory that it would take, especially in comparison to the very large amount of price data that I work with. "IncludeTradeHistoryInBacktest" is not used. There are about a dozen, custom variables. 64-bit. Using just a few days, or weeks, or months really doesn't cause this issue.

      I'm pretty sure what's happening is that when the Time frame is changed, the data for that new period is simply added to RAM, which would be the simple way to do this, and generally not a problem -- as long as one doesn't change the Time frame much, and the ranges covered by those Time frames is sufficiently small. I was just wondering if a way has been provided to dump what price data is in RAM (ie, re-set the cache), so I can then select a new Time frame.


        Hello spottysallrite,

        Having IncludeTradeHistoryInBacktest set to true (or not setting this and allowing it to default to true) makes a huge memory impact. Especially for optimizations.

        Try setting IncludeTradeHistoryInBacktest to false and comparing.
        Note, IncludeTradeHistoryInBacktest must be true to access the SystemPerformance collection.

        With Optimizations specifically, you can take advantage of IsInstantiatedOnEachOptimizationIteration being set to false.

        Last, if the strategy is drawing a large amount of drawing objects, you can choose not to instantiate these objects when testing in the Strategy Analyzer.

        The current release of NinjaTrader 8 is Be sure to run the latest version for any enhancements and bug fixes.

        Changing the time range I would not expect to change the memory. This would load blank instances of the script. No data would be loaded until the backtest or optimization is actually run.
        If you running a new test, then that would cause historical data to load in memory. However, just changing the time range without running a test I would not expect to cause memory to load.
        Last edited by NinjaTrader_ChelseaB; 04-20-2022, 03:18 PM.
        Chelsea B.NinjaTrader Customer Service


        Latest Posts


        Topics Statistics Last Post
        Started by SherwoodJP, 06-04-2024, 06:55 AM
        4 responses
        Last Post SherwoodJP  
        Started by dibDab, 11-09-2022, 09:04 AM
        13 responses
        Last Post MisterTee  
        Started by LordNoah, Today, 06:15 PM
        0 responses
        Last Post LordNoah  
        Started by oneybuchi2, Today, 03:48 PM
        2 responses
        Last Post oneybuchi2  
        Started by samish18, Today, 04:59 PM
        0 responses
        Last Post samish18