length in Highest Method

Questions about MultiCharts .NET and user contributed studies.
drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

length in Highest Method

Postby drolles » 28 Dec 2012

In the Highest function there is a “length” parameter.

What is that the length of? I’ve used it like this:

channel_high = PublicFunctions.Highest(BarsOfData(1).High, BarsOfData(1).CurrentBar, mintues_back);

Is that correct?

Thanks and regards,

drolles

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: length in Highest Method

Postby Henry MultiСharts » 28 Dec 2012

Length sets the number of bars to consider for testing the condition.
Was discussed here.

drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

Re: length in Highest Method

Postby drolles » 28 Dec 2012

Hi,

Thanks for that.

Though, I’m looking at this. It doesn’t make sense as one of the overloads is to Highest(ISeries, int length, int barsback).

So we are saying that you can pass in a longer ISeries yet specify that you only want it to go a X number of bars back into the ISeries, great.

Do you have to chop the ISeries before you pass it in? I’m getting errors about the Maximum number of bars back regardless of me setting it at 1600, then saying that I want the length to be 1500?

Thanks and regards,

drolles

drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

Re: length in Highest Method

Postby drolles » 28 Dec 2012

Additionally, where does it take the 1500 from? If it is element 0 of the array (ISeries) it will always reach past the Max number of Bars.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: length in Highest Method

Postby Henry MultiСharts » 09 Jan 2013

Hello drolles,

In your code you are constantly increasing the Length parameter:

Code: Select all

channel_high = PublicFunctions.Highest(BarsOfData(1).High, BarsOfData(1).CurrentBar, mintues_back);
This forces the function to reference further and further historical data with every calculation. On a certain bar the MaxBarsBack you have selected is not enough because length >= MaxBarsBack. MultiCharts increases the MaxBarsBack automatically and recalculates the study.
Please make the Length value constant in order to avoid this problem.

The solution was in the same thread I have mentioned above.
Length sets the number of bars to consider for testing the condition.
Was discussed here.


Return to “MultiCharts .NET”