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

Time stamp properties of a bar?

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

    Time stamp properties of a bar?

    Does the High/Low/Open/Close of a bar have time stamps? If so, how to access?

    I´m looking to find a more precise time aspect of high/low properties in a bar.

    Kindly, Fredrik
    Last edited by FREEN; 02-15-2016, 08:10 AM.

    #2
    Hello Fredrik,

    Each bar will have a Time, Open, High, Low, and Close series that are all accessed with the same BarsAgo value.

    For example:
    Print(Time[0].ToString());

    This would print the time of the most recent bar.

    Below is a link to the help guide on the Time series.
    http://ninjatrader.com/support/helpGuides/nt7/time.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      So it is not possible to get the exact time for when the high or low of a bar (=timespan) occurred?

      I´m looking for something like this:

      High[x].Time
      Last edited by FREEN; 02-15-2016, 09:40 AM.

      Comment


        #4
        Hello Fredrik,

        Thats not quite how it works.

        Take a look at the help guide on High and then take a look at the help guide on Time.
        High - http://ninjatrader.com/support/helpGuides/nt7/high.htm
        Time - http://ninjatrader.com/support/helpGuides/nt7/time.htm

        These are both series that contain one value for each bar. If you have a bars ago value to find a High, this same value can be used to find the time.

        High[5] - this would return the high from 5 bars ago
        Time[5] - this would return the time of that bar 5 bars ago

        In otherwords just use Time[x] and this will return the time of the bar that has that high.


        When you mention "So it is not possible to get the exact time for when the high or low of a bar (=timespan) occurred?", I'm not quite sure sure what you are asking for. Are you trying to return the high of a bar by selecting the bar by its time?
        Are you trying to locate a high a particular high and return the time of the bar that made that high?

        Each bar will have one high and will not have multiple highs. This means that you will not be able to return different highs of the same bar at different times.
        Last edited by NinjaTrader_ChelseaB; 02-15-2016, 10:17 AM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks Chelsea


          I´m very clear on the info in your answer. What I´m looking for is a detailed time granularity for open/close/high/low trade events. I´ll try to clearify my point:


          Let´s say a 1 min bar includes the time span 14:59:00 - 15:00:00. As far as I understand the Open is the FIRST trade in that timespan (that doesn´t necessarily occour at 14:59:00). The Close it the LAST trade (that doesn´t necessarily occour at 15:00:00).


          The High and the Low (highest and lowest trade during the time span) could have occoured at ANY point in the time span.


          So, is the exact time for those trading events stored in the database? What I would wish for was something like this:


          High[x].Time = 14:59:31
          Low[x].Time = 14:59:03


          Hope you get my point : )

          Comment


            #6
            Hello Fredrik,

            For each minute bar there are 4 price points saved with the historical data, the Open, High, Low, Close, and this is saved with the volume and close time of the bar. The intra-bar information of when each of these is made is not known.

            You can view this by clicking Tools -> Historical Data Manager... -> Edit
            Click the "+" plus to expand an instrument -> data type -> interval type -> date

            To find out when the high was made during that bar, you would need to add 1 second data or 1 tick data to the script. This would add the intra-bar granularity.
            http://ninjatrader.com/support/helpGuides/nt7/add3.htm

            Use a datetime variable to save the time each time the high is greater than the variable. Reset the variable on each new primary bar.

            You could then create a custom datetime series to track the time the high was made for each bar. Set this value before the datetime variable is reset.
            http://ninjatrader.com/support/helpG...ries_class.htm
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              It´s probably been done before. For anyone in need, enclosed it the code for Chelseas solution that works just fine for the purpose discussed in this thread.
              Attached Files

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by wzgy0920, 04-20-2024, 06:09 PM
              2 responses
              27 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 02-22-2024, 01:11 AM
              5 responses
              32 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 04-23-2024, 09:53 PM
              2 responses
              49 views
              0 likes
              Last Post wzgy0920  
              Started by Kensonprib, 04-28-2021, 10:11 AM
              5 responses
              193 views
              0 likes
              Last Post Hasadafa  
              Started by GussJ, 03-04-2020, 03:11 PM
              11 responses
              3,235 views
              0 likes
              Last Post xiinteractive  
              Working...
              X