How to find the current bar number?

Questions about MultiCharts .NET and user contributed studies.
MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

How to find the current bar number?

Postby MidKnight » 15 Aug 2012

Hello,

There must be a current bar number property somewhere, but I can't find it in the docs. I had thought that the Bars.CurrentBar would be the solution, but it seems that is for something else (not entirely sure what though). When I used CurrentBar output in a simple Output.Writeln() it didn't start outputting anything for several bars.

What is the MC.net way of getting the current bar number?

With thanks,
MK

User avatar
JoshM
Posts: 2089
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1525 times
Been thanked: 1486 times
Contact:

Re: How to find the current bar number?

Postby JoshM » 15 Aug 2012

MidKnight wrote:I had thought that the Bars.CurrentBar would be the solution, but it seems that is for something else (not entirely sure what though). When I used CurrentBar output in a simple Output.Writeln() it didn't start outputting anything for several bars.

Bars.CurrentBar returns the current bar for me. From your description, it seems that the max bars setting (see ExecInfo.MaxBarsBack) prevented the printing of the output for the first few bars.

Also see this wiki article on MaxBarsBack for regular MC (works the same in MC .NET though).
These users thanked the author JoshM for the post:
MidKnight


Return to “MultiCharts .NET”