Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CurrentBars Value doesnt seem to match.

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

    CurrentBars Value doesnt seem to match.

    I added 3 data series through an indicator the respective periods are 5 mins, 30 mins and 480 mins.
    When I tried to access them through CurrentBars, after I get some signal off the 480, the others CurrentBars[1] = -1, //For 5 mins
    and CurrentBars[2]=-1 for 30 mins

    eventually when their the Indicator was done with historical, the values were

    1 = [14813], 2= [14936], 3= [14995]

    Is there a way to force the order of DataSeries loading? Also is there a way to make the DataSeries bars to be relative Charts Preset value.

    #2
    I have found the answer I needed, sorry about the message. I found that the
    Note: Historical bars are processed according to their timestamps with the primary bars first, followed by the secondary, which is NOT guaranteed to be the same sequence that these events occurred in real-time.

    Comment


      #3
      You could try to manual call for an update before doing your calculation, based on the advice I got for a similar but a little bit different problem:
      I've created an indicator that calculates it's values based on a secondary 1 tick data series which works ok. But during real time calculations in a second indicator that uses the data of the first the values become inaccurate because the tick data set is not properly synced. Example: public class SupportingIndicator :


      Code:
      Update(BarsArray[i].Count -1, i); // i is the data series index
      I'm not sure if it will help because it will only invoke OnBarUpdate, but maybe NT will update the bars data internally because of the call.

      Comment


        #4
        Hello psytopy,

        Thanks fro your post.

        Logic can be separated in different BarsInProgress checks to ensure that logic is processed on a specific data series, but there is not a way to force the order in which the historical data is processed.

        The primary data series can be referenced when specifying null as the Instrument name. However, data that is added should otherwise use hard coded values as we don't advise accessing Instrument, Bars, User Input, or other data before the script reaches State.DataLoaded. This may work in many cases, but specifically will not work for optimizations. We suggest testing with hard coded values if you intend on adding a data series dynamically.

        Please see associated documentation below.

        Multi Time Frame Scripts - https://ninjatrader.com/support/help...nstruments.htm

        AddDataSeries - https://ninjatrader.com/support/help...dataseries.htm

        Calling Update would help for and added indicator that uses added data to calculate plot values, but would not allow you to change the order in which data is processed.

        We look forward to assisting.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        639 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        366 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        572 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X