Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time[0] question

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

    Time[0] question

    Hello,

    I have defined bid bars of 5 seconds. Printing Time[0] value I can observe that Time[0] doesn’t change with changes of the bids, it changes with changes of Last values.
    With a not very liquid instrument, it is very obvious.
    I thought that Time was related to date of the configured value not always with Last value.
    Code looks like this:
    if (!Historical)
    {
    Print(BarsInProgress + " " + Time[0] + " " + Close[0]);
    }
    Close values are OK (the bid value) but Time values are wrong because they only change with a Sale.
    Is it a normal behavior?


    Regards

    #2
    Hello jbesada,
    NinjaTrader stamps a bar with the closing time of the bar. Thus the time will not change unless a new bar has formed.

    Please refer to our help guide to know more on how NinjaTrader builds a bar.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      That is the point. Please see the log output of the following code:

      if (!Historical)
      {
      Print(BarsInProgress + " - " + DateTime.Now + " / " + Time[0] + " " + Close[0]);
      }


      0 - 24/09/2012 13:03:01 / 24/09/2012 12:56:20 0,7976
      0 - 24/09/2012 13:03:01 / 24/09/2012 12:56:20 0,7976
      0 - 24/09/2012 13:03:01 / 24/09/2012 12:56:20 0,7976
      0 - 24/09/2012 13:03:01 / 24/09/2012 12:56:20 0,7976
      0 - 24/09/2012 13:03:12 / 24/09/2012 12:56:20 0,7976
      0 - 24/09/2012 13:03:12 / 24/09/2012 12:56:20 0,7976
      0 - 24/09/2012 13:03:26 / 24/09/2012 12:56:20 0,7976
      0 - 24/09/2012 13:03:29 / 24/09/2012 12:56:20 0,7976
      0 - 24/09/2012 13:03:29 / 24/09/2012 12:56:20 0,7976
      0 - 24/09/2012 13:03:29 / 24/09/2012 12:56:20 0,7976
      0 - 24/09/2012 13:03:29 / 24/09/2012 12:56:20 0,7977


      Bar is configured with Bid 5 seconds, as you can see, Time[0] remains with the Last date value, but Bid data is coming and Bar would be closed. I hope my question is bit more clear now.


      Regards

      Comment


        #4
        Hello jbesada,
        To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

        Also please let me know the instrument on which you are testing the code and a step by step procedures to replicate the scenario.

        Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

        I look forward to assisting you further.

        *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        670 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        379 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        582 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X