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

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 PhillT, Today, 02:16 PM
      2 responses
      3 views
      0 likes
      Last Post PhillT
      by PhillT
       
      Started by Kaledus, Today, 01:29 PM
      3 responses
      9 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by frankthearm, Yesterday, 09:08 AM
      14 responses
      47 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by gentlebenthebear, Today, 01:30 AM
      2 responses
      14 views
      0 likes
      Last Post gentlebenthebear  
      Started by PaulMohn, Today, 12:36 PM
      2 responses
      17 views
      0 likes
      Last Post PaulMohn  
      Working...
      X