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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        68 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        150 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        100 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        288 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X