Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close[0]

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

    Close[0]

    How do I know if this quantity is defined when OnBarUpdate() is called? Since the bar may not have closed yet.

    #2
    Close[0] will take the latest tick if the bar isn't "closed" yet. To know if the bar is closed you simply have to wait for the next bar's first tick to come in then reference Close[1] to go back to the previous bar's close price. To check this you can do:
    Code:
    if (FirstTickOfBar)
         Print("Previous Bar's Close = " + Close[1]);
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Makes sense, cheers!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by xulu13, Today, 05:01 PM
      0 responses
      3 views
      0 likes
      Last Post xulu13
      by xulu13
       
      Started by Pbarrionuevo, Today, 04:30 PM
      0 responses
      4 views
      0 likes
      Last Post Pbarrionuevo  
      Started by vantojo, Today, 01:39 PM
      0 responses
      19 views
      0 likes
      Last Post vantojo
      by vantojo
       
      Started by Rubens_2020, Today, 01:48 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by kempotrader, Today, 01:34 PM
      1 response
      25 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Working...
      X