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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      72 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      39 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X