Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CurrentBar vs. Bars.Count?

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

    CurrentBar vs. Bars.Count?

    Hi there, what is the difference between CurrentBar and Bars.Count? Both seem to be the current number of bars on the chart. Thanks.


    #2
    Hello timmbbo,

    Thank you for your post.

    CurrentBar is a number representingthe current barin a Bars object that the OnBarUpdate() method in an indicator or strategy is currently processing. Bars.Count is the total number of bars in the Bars array.

    There will always be two less CurrentBar indexes than the size(Count) of the array when using Calculate.OnBarClose. If you use Calculate.OnEachTick, it will be one less(since it includes the currently building bar).

    You can see this by printing out the CurrentBar and Bars.Count.

    Please let us know if you have any further questions.​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X