Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reading the period type of the parent chart

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

    Reading the period type of the parent chart

    Is there a way to read the chart's PeriodType?

    For example, in my Initialize() I want to add a chart as follows

    Add(PERIOD_TYPE_OF_PARENT_CHART, 5);


    The goal here is to use a variable input for the period and always set the bars being added to match that of the parent.

    #2
    Hello shazzmoe,

    Thanks for the note. I am happy to help.

    Inside ‘Initialize()’ we do not recommend accessing any bar series to prevent errors in cases where it can be run before you actually have a bar series. So when you ‘Add()’ to any series we recommend that it is hard coded in NinjaScript for stability reasons.

    You can check the Data Series “BarPeriod” to get a period type back for use in your indicator/strategy. An example of this can be found in the following indicator linked below.


    For more information about "BarPeriod" you may read our online help guide at the following link.


    For more information about "Add()" you may read our online help guide at the following link.


    Please let me know if I can further assist you.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thank you for the info.

      One more question.

      Is it possible to access chart data in the OnExecution() method from a chart other than the primary chart?

      Because BarsInProgress has no relevance here I'm assuming the answer is no, but I could be wrong. I know of a workaround but want to make sure there isn't a more efficient way first.

      Comment


        #4
        shazzmoe, correct BarsInProgress has no relevance for filtering in OnExecution(), you can try accessing the various price arrays though available - Closes, Highs, Lows...

        Comment


          #5
          thank you so much I had totally forgotten about the barSeriesIndex

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, Yesterday, 10:06 AM
          0 responses
          20 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          18 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          14 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          9 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          38 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X