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 alifarahani, Today, 09:40 AM
      0 responses
      1 view
      0 likes
      Last Post alifarahani  
      Started by Gerik, Today, 09:40 AM
      0 responses
      1 view
      0 likes
      Last Post Gerik
      by Gerik
       
      Started by RookieTrader, Today, 09:37 AM
      0 responses
      5 views
      0 likes
      Last Post RookieTrader  
      Started by KennyK, 05-29-2017, 02:02 AM
      3 responses
      1,282 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by AttiM, 02-14-2024, 05:20 PM
      11 responses
      184 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X