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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        24 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        282 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        280 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        131 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        90 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X