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[0].Ticks

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

    Time[0].Ticks

    What event is setting the time in Time[0].Ticks

    the open of the bar, the close of the bar or the last trade ?

    Does the answer depend on whether CalculateOnBarClose = true or not?
    Jim-Boulder
    NinjaTrader Ecosystem Vendor - Elephant Tracks

    #2
    Hi Jim-Boulder,

    A bar's time stamp is based on the closing time of the bar. Understanding the variables involved in building chart bars

    .Ticks is a .net Date/Time property. More information on this specifically is here:
    Gets the number of ticks that represent the date and time of this instance.


    Yes, script updating varies based on your CalculateOnBarClose setting. When set to true, you receive updates for the last closed bar. When set to false you receive updates for every incoming tick.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan,

      I understand what time[0].Ticks is as far as a DateTime property, but I am a little confused by your response---if time[0].Ticks is returning the time stamp of the bar's close--this is the same time for all 'trades' (ticks) for that bar-so it doesn't seem like the setting of true or false for CalculateOnBarClose should make any difference.

      I understand how CalculateOnBarClose's setting affects the processing of tick x tick vs. once per bar---but the close of bar X is at one point in time regardless of this setting, right?
      Jim-Boulder
      NinjaTrader Ecosystem Vendor - Elephant Tracks

      Comment


        #4
        Yes, historically it works the same regardless of COBC settings. Historical script updating is always COBC = true. In real time, you have the opportunity to see any property updated with each tick, with CalculateOnBarClose = false.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I'm having a brain freeze day Ryan--so I apologize for asking again--but in real time, if I have CalculateOnBarClose = false--then the value returned for Time[0].Ticks will be the time of the last trade (the last tick x tick processed) and NOT the close of Bar[0] ?

          The reason I am asking is that I have a simple indicator that prints Time[0].Ticks and I have set it to CalculateOnBarClose=false but I am getting the same value of Time[0].Ticks in real time for each bar (it only changes on a new bar)--which is suggesting to me it is NOT changing in real time...it is close of bar regardless of CalculateOnBarClose setting-(In real time)
          Jim-Boulder
          NinjaTrader Ecosystem Vendor - Elephant Tracks

          Comment


            #6
            Thanks for the reply. I can see where the confusion may be. If using time intervals then the bar's time stamp represents the end of the bar, not the time of the last trade. For time based charts the time stamp of bars takes place at even intervals regardless of COBC settings. You are getting rt updates, but it is the same value every time. This Print statement should help show this:

            Print(Time[0] + " " + Time[0].Ticks);

            You can switch to tick resolution charts and the time stamp for the bar currently forming represents the time of the last trade instead. Tick based charts are: Tick, Volume, Range, Second, and Renko.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Thanks for your patience--I now understand! Thanks again.
              Jim-Boulder
              NinjaTrader Ecosystem Vendor - Elephant Tracks

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Karado58, 11-26-2012, 02:57 PM
              8 responses
              14,825 views
              0 likes
              Last Post Option Whisperer  
              Started by Option Whisperer, Today, 09:05 AM
              0 responses
              1 view
              0 likes
              Last Post Option Whisperer  
              Started by cre8able, Yesterday, 01:16 PM
              3 responses
              11 views
              0 likes
              Last Post cre8able  
              Started by Harry, 05-02-2018, 01:54 PM
              10 responses
              3,203 views
              0 likes
              Last Post tharton3  
              Started by ChartTourist, Today, 08:22 AM
              0 responses
              6 views
              0 likes
              Last Post ChartTourist  
              Working...
              X