Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to read time period of data series?

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

    How to read time period of data series?

    Hi,

    I am developing a strategy for automated execution.

    I want the strategy to work in multiple time frames, using different logic. So how do I dynamically read the time period of a data series into ninjascript, so I can execute different code blocks.

    I am referring to the primary data series, as the periodicity of the Add'ed data series are known.

    #2
    Hello,
    Thank you for your post.
    You can check the primary dataseries period type and value by checking the BarsPeriod.
    For example if I wanted to check if the primary data series is a 5 minute bar I would do the following :

    protected override void OnBarUpdate()
    {
    if(BarsPeriod.Id == PeriodType.Minute && BarsPeriod.Value == 5)
    //Do Something
    }

    For more information on the BarsPeriod property please see the following link: http://ninjatrader.com/support/helpG...barsperiod.htm

    If we can be of any other assistance please let us know.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Thank you, Cody. That is exactly what I needed

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      118 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      166 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      85 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      130 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      88 views
      0 likes
      Last Post PaulMohn  
      Working...
      X