Announcement

Collapse

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

Collapse

Strategy Analyser backtesting - where does the data come from?

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

    Strategy Analyser backtesting - where does the data come from?

    Newbie question: when using the strategy analyser to do backtesting, I can select any date range (say 1/1/2019 - 28/2/2019) and it performs the backtest without a glitch, whether or not I'm connected to my provider.

    How can I be sure that NT has all the data it needs to do an accurate backtest? Where is it getting this data from?

    I wasn't trading every day this year, and I haven't downloaded all the data for this year manually, so I'm fairly sure the data isn't cached locally.

    #2
    Hello thesorehead,

    Thank you for the question.

    The data you are seeing would be locally cached data which was at one point either downloaded from the data provider as historical data or was recorded from realtime into the historical cache. You can see what data you have in the historical data manager along with other management options: https://ninjatrader.com/support/help...ta_manager.htm

    To be sure the platform has the complete dataset, you would likely want to connect to the data provider and pull up a chart for that period of time and then Right click -> Reload all historical data. This will request the period of time from the provider and download what is available. The length of data you request will matter in case the provider does not offer that far back, in those situations you can choose to record live data as historical to build up a cache of data or import data from external sources.

    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesse. I pulled up a chart and set "Days to load" to 60. Browsing back through the chart it appears all the days are there, so hopefully that means all the data is in the cache!

      Comment


        #4
        Originally posted by thesorehead View Post
        Where is it getting this data from?
        "Where it comes from" depends upon who your data provider is. For most users, this is probably Rithmic or Continuum, which means the historical data actually comes from the NinjaTrader historical data servers, which your NinjaTrader.exe connects to automatically when connecting to your Rithmic or Continuum account.

        This page,
        https://ninjatrader.com/support/help...rical_data.htm
        seems to state the historical data comes from the service provider, but I think what technically happens is that NT actually records the data in real-time from a single (I think) service provider to their own private internal file servers, and then later dispenses it to your NinjaTrader.exe on demand as historical data via a connection to NT's historical data servers (aka, their private internal file servers).

        Be aware there are limits to how much data NT stores on their historical data servers.
        I think NT only stores 1 year of Tick data for each instrument, where as Minute and Day historical data are practically infinite.

        Originally posted by thesorehead View Post
        How can I be sure that NT has all the data it needs to do an accurate backtest?
        If you are connected to your data feed provider, then Strategy Analyzer should automatically download any missing historical data.

        However, if your strategy does anything fancy with secondary data series using the Add() method, I'm not completely convinced(*) the data needed to satisfy the needs of the added data series would be automatically downloaded.

        In any event, you can manually download any needed historical data using the Historical Data Manager.

        CC -> Tools -> Historical Data Manager -> Download tab

        I usually check all the boxes Tick/Minute/Day and Ask/Bid/Last. I have my doubts as to the usefulness of the Bid/Ask historical data, but usually download it anyways. Set your start date as needed, and click the Download button.

        (*)For me, downloading all the data manually guarantees that my strategies running on minute bars also have the tick data needed for a 1-tick secondary data series.

        Some tips:
        1. Make sure to use the 64-bit version of NT to download, esp for large date ranges, esp for Tick data.
        2. The 32-bit version may eventually 'stall' due to the maximum 3GB memory limit on the process size.
        3. Backtests seem to run faster if you're disconnected from all data providers.

        Also,
        You can check which historical data is stored on your system by checking the three folders where the files are stored,
        Code:
        <My Documents>/NinjaTrader 7/db/day
        <My Documents>/NinjaTrader 7/db/minute
        <My Documents>/NinjaTrader 7/db/tick
        If you examine the names of the files in those folders (and subfolders) you will soon be able to determine what historical data you have and what historical data is missing.

        The data folder,
        Code:
        <My Documents>/NinjaTrader 7/db/data
        is where Market Replay data is stored and is not used by the Strategy Analyzer.

        The cache folder,
        Code:
        <My Documents>/NinjaTrader 7/db/cache
        is a special folder which caches the historical+realtime data most recently used by (for ex) a chart window.

        Sometimes you will see advice to delete the contents of this cache folder in order to fix a data problem.
        I do this fairly regularly and have never had a problem, just make sure that NT is not running when you do this.

        On a final note, be extra alert to the use of the term 'cache', it is a bit overloaded.

        The 'cache folder' is a very specific thing, but it is not the same thing as the general expression 'locally cached data'.

        The expression 'locally cached data' would refer to the historical data stored in the three "day/minute/tick" folders.
        Last edited by bltdavid; 03-04-2019, 07:57 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Fran888, 02-16-2024, 10:48 AM
        3 responses
        45 views
        0 likes
        Last Post Sam2515
        by Sam2515
         
        Started by martin70, 03-24-2023, 04:58 AM
        15 responses
        114 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by The_Sec, Today, 02:29 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by jeronymite, 04-12-2024, 04:26 PM
        2 responses
        31 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by Mindset, 05-06-2023, 09:03 PM
        10 responses
        265 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X