Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Count Bars on MultiTimeframe

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

    Count Bars on MultiTimeframe

    Hello Dear Friends.
    I have two DateTime value.

    DateTime dateStartTime, dateEndTime.

    On chart open Time Frame Minute 1.

    How I can get count bars range intDeltaBarsFromM5Chart = ???(dateStartTime - dateEndTime) from the chart period Minute 5, Minute 10 and Minute 60 in the indicator?

    Thank you very much.

    #2
    Hello _Roman,

    Thank you for your post.

    If I'm understanding you correctly, you are looking to find out how many bars of each of your additional data series (5 minute, 10 minute and 60 minute) were timestamped between the dateStartTime and the dateEndTime. Is that correct?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello _Roman,
      Is that correct?
      Yes, of course.

      Comment


        #4
        Hello _Roman,

        Thank you for your reply.

        The simplest way would be to set up a time condition in OnBarUpdate() so that if the time is between dateStartTime and dateEndTime that we can then assess which Bars are in progress, and then increment a count variable each time a bar is processed that is timestamped in that period. Once you're outside of that time period, you could then use those counters to see how many bars were processed.

        So, you could start with something like this:

        Code:
                    if ((Times[0][0].TimeOfDay >= DateStartTime.TimeOfDay)
                         && (Times[0][0].TimeOfDay == DateEndTime.TimeOfDay) && BarsInProgress == 1)
                    {
                        Minute5Count++;
                    }
        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Thank you Kate.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Jonker, Today, 01:19 PM
          0 responses
          1 view
          0 likes
          Last Post Jonker
          by Jonker
           
          Started by futtrader, Today, 01:16 PM
          0 responses
          5 views
          0 likes
          Last Post futtrader  
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,791 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          842 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,294 views
          1 like
          Last Post jgualdronc  
          Working...
          X