Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How NinjaTrader detects (forms) BarClose event?

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

    How NinjaTrader detects (forms) BarClose event?

    lets say, we have indicator set to Calculate.OnBarClose.
    this means to catch the closing tick/update of the bar. But my question is how that happens?
    i.e. we have indicator:

    Code:
    Print(Close[0]);
    Print(Volume[0]);
    for example, we are on 1 minute chart, and incoming ticks/updates has happened in this way:

    14:47:54 (price 103.25)
    14:47:57 (price 103.55)
    14:48:04 (price 104.64)

    so, at what time would "BarClose" event triggers or when it triggers, what price would be printed?

    if that trigger happens at 14:48:04, then it will be the "first tick of bar" event, not the "last-tick of bar" update.
    if that trigger happens at ..:47:57 , then how NT knows that it would be the last tick of the bar?
    if that trigger happens at ..:48:00 (while actually there has not happened any incoming tick/update), then what would be price or volume at that moment, how NT forms that?

    I am interested how NT works with regard to this subject..

    #2
    Hi ttodua, thanks for your note.

    When a script runs on bar close it does not catch the last tick of the bar, it has no synchronicity with the incoming ticks. Only a OnEachTick script is guaranteed to be called in sync with incoming ticks. A time based bar with an OnBarClose script will just close when an internal timer ticks.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    599 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    344 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    558 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    557 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X