Inconsistency with "Bars.FullSymbolData.Count" and/or "Bars.FullSymbolData.Current"  [SOLVED]

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

Inconsistency with "Bars.FullSymbolData.Count" and/or "Bars.FullSymbolData.Current"

Postby Jobauma » 18 Feb 2019

Hi.

I use "Bars.FullSymbolData.Count" and "Bars.FullSymbolData.Current" to make a set amount of bars ( regardless of " Bars Back" ), like this.

Code: Select all

int NumberOfBars = 144;

if ( Bars.FullSymbolData.Current > Bars.FullSymbolData.Count - NumberOfBars )
{
// [CODE]
}
Opening charts for the 1st time works fine ( almost always ). But when doing something like reloading, or jumping back for playback, these two properties doesn't seem to be accurate, in relation to each other. :) It's usually that "NumberOfBars" becomes something less than "144". :D

Can this be fixed?



Best regards,
Johannes Hillestad Baumann

User avatar
Svetlana MultiCharts
Posts: 208
Joined: 19 Oct 2017
Has thanked: 1 time
Been thanked: 52 times

Re: Inconsistency with "Bars.FullSymbolData.Count" and/or "Bars.FullSymbolData.Current"

Postby Svetlana MultiCharts » 22 Feb 2019

Hello, Johannes,

Please send us the following files to support@multicharts.com so that we would be able to investigate the issue:

1. The workspace where the issue is reproduced.
2. Export of used symbols (with data) from QuoteManager in .qmd archive: http://www.multicharts.com/trading-soft ... rting_Data
3. The exported scripts with all dependent functions that are used on the workspace: http://www.multicharts.com/trading-soft ... ng_Studies
4. The screenshots demonstrating the issue.
5. Step-by-step instruction how to reproduce the issue.

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

Re: Inconsistency with "Bars.FullSymbolData.Count" and/or "Bars.FullSymbolData.Current"

Postby Jobauma » 23 Feb 2019

Hi.

It isn't something wrong with the code. :)

Changing the code to this ( with a zero instead )...

Code: Select all

if ( Bars.FullSymbolData.Current > 0 )
{
// CODE
}
...makes it work. I can still have only 34 plots back by reseting, but it's a heavy indicator, so it takes some time to load.

I'm using it to decide when the calculation of the indicator starts, then I'm reseting the plots to something even less. :)

Steps to reproduce the issue is to reload the chart ("Ctrl+R"), changing an input in the indicator, or jump back for playback.

Something else is that I'm sometimes using this concept like this:

Code: Select all

int StartCalcBarsBack = 144;

if ( Bars.FullSymbolData.Current > Bars.FullSymbolData.Count - ( StartCalcBarsBack + 34 ) )
{
// CODE

if ( Bars.FullSymbolData.Current > Bars.FullSymbolData.Count - StartCalcBarsBack )
{
// CODE
}
}
I think I'm going to stop using this solution, until it is solved.

Sometimes the indicator doesn't load anything at all, but it works the 1st time the indicator loads. This is strange. :)



Best regards,
Johannes Hillestad Baumann

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

Re: Inconsistency with "Bars.FullSymbolData.Count" and/or "Bars.FullSymbolData.Current"

Postby Jobauma » 23 Feb 2019

Hi.

I'm sincerely sorry!

It was something in the code that prevented (locked) the indicator to plot other things ( at a certain point ). This should be fixed. I can tell you that it was a grid ( with trendlines ) that did something when one of the values was equal to zero ( based on extremes of zigzag and bars back of that extreme ). :D

It is strange that everything worked fine on the 1st load, but not when refreshing the indicator, etc.



Best regards,
Johannes Hillestad Baumann

darob
Posts: 178
Joined: 20 Nov 2014
Has thanked: 48 times
Been thanked: 24 times

Re: Inconsistency with "Bars.FullSymbolData.Count" and/or "Bars.FullSymbolData.Current"

Postby darob » 23 Feb 2019

Hi Jobauma, this seems very cryptic to me as the details in your posts are a bit thin, but I’ve had an issue where an indicator loaded correctly initially only to fail on refresh and it was because I hadn’t declared initial values in StartCalc().

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

Re: Inconsistency with "Bars.FullSymbolData.Count" and/or "Bars.FullSymbolData.Current"  [SOLVED]

Postby Jobauma » 24 Feb 2019

Hi, darob.

I tried to do something in "StartCalc", but I couldn't make it work. The part of the zigzag code works like this:

Code: Select all

public void ZigzagCountExtremeBarsBack( out int ExtremeBarsBack, double Extreme )
{
int I = 0;
bool Done = false;

ExtremeBarsBack = 0;



while (!Done)
{
if ( m_Zigzag_Price[I] != Extreme )
ExtremeBarsBack++;
else Done = true;



I++;
}
}
This method counts back and finds the last extreme, if there are similar extremes, and not the first one of those. The value of the extreme itself is based on the first it finds, regardless of coming extremes that are similar.

The "doubles" and "ints" I use for "ExtremeBarsBack" when the extreme is confirmed ( price has moved beyond the limit in opposite direction ):

Code: Select all

// 1st, 2nd and 3rd Extreme:

m_Zigzag_pr2Extreme = m_Zigzag_preExtreme;
m_Zigzag_preExtreme = m_curZigzag_Extreme;
// m_Zigzag_curExtreme = m_Zigzag_New_High[1]; // OR
// m_Zigzag_curExtreme = m_Zigzag_New_Low[1];

// " New High " has been reset to " New Low ", and " New Low " to " New High ",
// to find new highs and lows. Thus "[1]". " if ( m_Zigzag_Price[0] > m_Zigzag_New_High[0] ) " /
// " if ( m_Zigzag_Price[0] < m_Zigzag_New_Low[0] ) "



// Count Current/Previous Extreme Bars Back:

// Whole Span + Setback:
ZigzagCountExtremeBarsBack( out m_Zigzag_WholeSpan, m_Zigzag_preExtreme );

// Setback: The wave has moved in opposite direction, and is confirmed:
ZigzagCountExtremeBarsBack( out m_Zigzag_Setback, m_Zigzag_curExtreme );

// Actual Whole Span ( Whole Span without Setback ):
m_Zigzag_WholeSpan = m_Zigzag_WholeSpan - m_Zigzag_Setback;
The solution to my problem was to wrap the grid code inside " if ( m_Zigzag_preExtreme != 0 ) ". :)

I've set "m_Zigzag_curExtreme", "m_Zigzag_preExtreme" and "m_Zigzag_pr2Extreme" to "0" in "StartCalc". :P



Best regards,
Johannes Hillestad Baumann

darob
Posts: 178
Joined: 20 Nov 2014
Has thanked: 48 times
Been thanked: 24 times

Re: Inconsistency with "Bars.FullSymbolData.Count" and/or "Bars.FullSymbolData.Current"

Postby darob » 25 Feb 2019

've set "m_Zigzag_curExtreme", "m_Zigzag_preExtreme" and "m_Zigzag_pr2Extreme" to "0" in "StartCalc". :P

That was what I was getting at, sorry I can't be of further help. Good luck.


Return to “MultiCharts .NET”