Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Specified Time

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

    Specified Time

    Hi!

    I would like to calculate the Close of 1,2,3... days ago bar with the same time as now.

    I.E. -> Now its 19:15 (12/01/2009), i would like to know the Close for 19:15 (11/01/09) and 19:15 (10/01/09)...

    Any idea? I´m not very good managing time functions...

    Thanks a lot (and sorry about my english)!

    #2
    Hi Santi,

    You want to use GetBar() and then Close[x] where x is the value determined by GetBar().

    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi! Thanks for the answer...

      I have already tried that way, but I don´t know how to update the DateTime structure (GetBar(new DateTime(YYYY, MM, DD, H, M, S)) to current time...

      Once I get it, it will be very easy:

      GetBar(new DateTime(YYYY, MM, DD-1, H, M, S))
      GetBar(new DateTime(YYYY, MM, DD-2, H, M, S))
      GetBar(new DateTime(YYYY, MM, DD-3, H, M, S))

      But... How can I do that?

      Thanks again!

      P.D.: There would be another problem if today is the first of the month... so yesterday was not DD-1... ;-(

      Comment


        #4
        GetBar(Time[0].AddDays(-1))
        GetBar(Time[0].AddDays(-2))
        GetBar(Time[0].AddDays(-3))
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks man!!! You´re great!!!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X