Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Force AddDataSeries() to use cached data?

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

    Force AddDataSeries() to use cached data?

    Hello,
    I have an indicator on a chart with a single instrument. I set instrument last day to load a day ago, to make sure it uses cache.

    I added data series in state.configure:


    Code:
    else if (State == State.Configure)
    {
    
    
        AddDataSeries("AMG", new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 5 }, 20,"US Equities ETH", null);
        AddDataSeries("AFL", new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 5 }, 20,"US Equities ETH", null);
    …    …….
    }
    I added many more instruments series there (150 in total), not shown for brievety of code..

    Each time I reload the ninjascript, it take 1 mn to proceed, which is the duration it took initially.
    I suspect it downloads all the data again, as I removed all calculation just to make sure it wasn't an issue with indicator calculation.

    How could I prevent this, and force it to use what's in cache?

    For backtesting purpose I only use this on historical data and don't need refresh or real time.
    Last edited by Duval; 07-01-2019, 05:57 AM.

    #2
    Hello Duval,

    There would be no way to bypass loading the data if you request it.

    The AddDataSeries method will request data if you are using a tool which can request data and also if you are connected. Otherwise this method calls the cache data along with a lot of other internal actions to build the requested bar series for your script. This can still take time even if you are disconnected and just using downloaded data as the requested series are being processed.

    I look forward to being of further assistance.

    Comment


      #3
      Thanks Jess, any other alternative way to load some series purely from cache and use it in a strategy backtesting context?

      Comment


        #4
        Hello Duval,

        Not at this time, AddDataSeries is the only means to add a Series in NinjaScript currently.

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X