Bars.FullSymbolData.Count

Questions about MultiCharts .NET and user contributed studies.
User avatar
Jobauma
Posts: 100
Joined: 16 Apr 2013
Has thanked: 22 times
Been thanked: 4 times

Bars.FullSymbolData.Count

Postby Jobauma » 09 Jul 2018

Hi.

I’m trying to make an indicator to plot on some last bars. The code is like this:

Code: Select all

if ( Bars.CurrentBar >= Bars.FullSymbolData.Count - 34 )
This should plot on the last 34 bars. I have to increase 34 to 377 or something like that to make something happen. (So the count of Bars.FullSymbolData.Count is actually more than the true amount of bars.)

These two should be the same, but aren’t:

Code: Select all

if ( Bars.CurrentBar >= Bars.FullSymbolData.Count )

if (Bars.LastBarOnChart)
Am I missing something, or is there a way to get the right count of the bars on a chart? :)

User avatar
Henry MultiСharts
Posts: 9066
Joined: 25 Aug 2011
Has thanked: 1256 times
Been thanked: 2911 times

Re: Bars.FullSymbolData.Count

Postby Henry MultiСharts » 13 Jul 2018

Hello Jobauma,

Bars.FullSymbolData.Count is the total number of bars on the chart.
Bars.FullSymbolData.CurrentBar = Bars.CurrentBar + ExecInfo.MaxBarsBack.
Bars.CurrentBar is never equal to Bars.FullSymbolData.Count.

User avatar
Jobauma
Posts: 100
Joined: 16 Apr 2013
Has thanked: 22 times
Been thanked: 4 times

Re: Bars.FullSymbolData.Count

Postby Jobauma » 13 Jul 2018

The indicator I've made unfortunately takes some time to load, and it's not necessary to plot on all the bars. So the reason why I have several thousand bars on each chart is because I use playback in the weekends, but I do not analyse all of them. I know that "Bars.CurrentBar >= 987" would reduce some plotting (limit from the first bar), but the number of bars on each chart differs, so what I'm trying to achieve is to limit the plotting from the last bar (instead of from the first bar). Is this possible? :)

User avatar
Henry MultiСharts
Posts: 9066
Joined: 25 Aug 2011
Has thanked: 1256 times
Been thanked: 2911 times

Re: Bars.FullSymbolData.Count

Postby Henry MultiСharts » 17 Jul 2018

Jobauma,

Yes, that is possible to program such an indicator. You can remove the plot values using Plot1.Reset.

User avatar
Jobauma
Posts: 100
Joined: 16 Apr 2013
Has thanked: 22 times
Been thanked: 4 times

Re: Bars.FullSymbolData.Count

Postby Jobauma » 18 Jul 2018

Cool! Didn't know about the reset function. :)

What I'm trying to achieve is this:

Code: Select all

if ( Bars.CurrentBar > NumberOfBars - 34 )
{
"Some calculation and plotting"
}
Wish I only knew what to replace NumberOfBars with. This would do something on the last 34 bars. :P

Anyone?

User avatar
ABC
Posts: 626
Joined: 16 Dec 2006
Has thanked: 119 times
Been thanked: 355 times
Contact:

Re: Bars.FullSymbolData.Count

Postby ABC » 18 Jul 2018

Wish I only knew what to replace NumberOfBars with. This would do something on the last 34 bars. :P
Hi Jobauma,

you can use Bars.FullSymbolData.Count and Bars.FullSymbolData.Current.
Bars.FullSymbolData.Count gives you the total number of bars on the chart and Bars.FullSymbolData.Current gives you the bar that you are currently at.

Regards,

ABC

User avatar
Jobauma
Posts: 100
Joined: 16 Apr 2013
Has thanked: 22 times
Been thanked: 4 times

Re: Bars.FullSymbolData.Count

Postby Jobauma » 18 Jul 2018

Hello ABC,

Thanks a bunch!


Return to “MultiCharts .NET”