Is there a keyword for checking if a data series is present?  [SOLVED]

Questions about MultiCharts and user contributed studies.
wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Is there a keyword for checking if a data series is present?

Postby wilkinsw » 23 Oct 2014

Hi,

When using multiple dataseries......

Was just wondering if there was a keyword to check for presence of data2,3,4 etc on a chart.

E.g. If data2=not present then xyz

Many thanks!

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Is there a keyword for checking if a data series is pres  [SOLVED]

Postby furytrader » 23 Oct 2014

I believe that if you try to apply a signal that uses multiple data series on a chart that does not have multiple data series, you will get an error right off the bat. In other words, your code won't run.

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: Is there a keyword for checking if a data series is pres

Postby wilkinsw » 23 Oct 2014

Oh yes. Good point. Silly me!

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Is there a keyword for checking if a data series is pres

Postby JoshM » 25 Oct 2014

I believe that if you try to apply a signal that uses multiple data series on a chart that does not have multiple data series, you will get an error right off the bat. In other words, your code won't run.
It would be helpful, I think, if there is a PowerLanguage keyword that returns the number of data series on the current chart:

Feature request - MC-1779 - Keyword that returns the number of data series

That would enable us to prevent these errors programmatically so that the code can keep running.

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: Is there a keyword for checking if a data series is pres

Postby wilkinsw » 08 Jul 2015

I've run into this again.

For example:

If I have 10 different contracts on 1 chart and wanted to total up the volume across all contracts......

but

if, say 1 contract is blank (no price/volume prints) for a certain time period, then the indicator doesn't plot, until all contracts used in the indicator have data points present.

My question is.....

how do I get the indicator to keep summing up the volume bar after bar even when one just data series has gaps/ hasn't started yet? Is this something I can add to the code? "If data1 is present" then xyz etc etc.

Thanks.

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

Re: Is there a keyword for checking if a data series is pres

Postby Henry MultiСharts » 15 Jul 2015

I've run into this again.

For example:

If I have 10 different contracts on 1 chart and wanted to total up the volume across all contracts......

but

if, say 1 contract is blank (no price/volume prints) for a certain time period, then the indicator doesn't plot, until all contracts used in the indicator have data points present.

My question is.....

how do I get the indicator to keep summing up the volume bar after bar even when one just data series has gaps/ hasn't started yet? Is this something I can add to the code? "If data1 is present" then xyz etc etc.

Thanks.
Hello wilkinsw,

The main thing is to have the bars on the data series that is selected in "Base Data #" of indicator, as they trigger the code calculation. For additional data series if bars are missing the code utilizes the data values according to the Realtime-History Matching option.


Return to “MultiCharts”