Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Confused about Close[0]

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

    Confused about Close[0]

    Example from manual:
    if (Close[0] > Close[1]) Print ("We had an up day");

    If CalculateOnBarClose is true, isn't every single tick the "close" so that if you run this code with that option on, you don't really know if you had an up day when you're running this test as you could always wind up lower at the end of the bar?.
    Now, if CalculateOnBaClose is false, you don't know when the bar has ended until you get the first tick of the next bar and then isn't Close[0] really Close[1] at that point?
    As I wrote above, I'm confused.
    Thanks,
    Stephen

    #2
    Stephen, it's more the other way around - CalculateOnBarClose = true calcs only on the bar close == the opening tick of the new bar, so you would then be in the position to know if you had an upday or not as the closing tick of the bar is in.

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Stephen, it's more the other way around - CalculateOnBarClose = true calcs only on the bar close == the opening tick of the new bar, so you would then be in the position to know if you had an upday or not as the closing tick of the bar is in.
      Bertrand,

      That explains the perverse behavior I have seen. If you are working with EOD data then you must always set COBC false. If it is true, then you will not process the last bar on your chart until the next day. For example, if you examine your charts in the evening, your indicators will not be up to date as of that day.

      Suggestion: NT ought to know when time-based bars are complete, and process them right away, without waiting for the next day. Otherwise you sit there wondering "What do you mean that today's NYSE trading has not closed? Try telling the NYSE that!"

      --EV

      Comment


        #4
        Thanks for the suggestion EV - NT's framework is event based and not time based .

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          Thanks for the suggestion EV - NT's framework is event based and not time based .
          First of all, this is not really a problem for me -- since I am doing nothing tick-based I just always turn off COBC.

          Whether or not you have them now, there certainly could be time events. Perhaps for those markets that do have a set open and close, such as NYSE, an event could be generated for the market open and close. I have not paid attention to strategies yet, but I can easily imagine wanting to do things with respect to market open and close. Market close could be used to mark bars for that market closed, rather than waiting for the next market day's trading to begin.

          As I said, no big deal for me personally -- just one of those little oddities. After all, it is "Calculate On Bar Close", not "Calculate When The Next Bar Opens".

          --EV

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          574 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          332 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X