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 cmoran13, Yesterday, 01:02 PM
          0 responses
          29 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          21 views
          0 likes
          Last Post PaulMohn  
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          160 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          95 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          148 views
          2 likes
          Last Post CaptainJack  
          Working...
          X