Run code on chart with zero bars

Questions about MultiCharts and user contributed studies.
brendanh
Posts: 158
Joined: 07 Apr 2007
Has thanked: 1 time

Run code on chart with zero bars

Postby brendanh » 15 May 2013

Hi,
I would like to cycle through a list of symbols and write the OHLC data to a csv (Ascii) file. When each symbol finishes writing, I load the next symbol in the list using the line:

Code: Select all

if lastbaronchart then CommandLine(".csy name=<NEXT_SYMBOL_NAME>");
I am using v8.7 beta.
It all works fine, however if one of the symbols in my list contains no bars (ie there is no data), then this line of code never runs and the next symbol does not load.
Can anyone suggest how to detect when a chart has zero bars? Ie

Code: Select all

if lastbaronchart or ThereAreZeroBars then CommandLine(".csy ...
Many thanks,
Brendan

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

Re: Run code on chart with zero bars

Postby Henry MultiСharts » 16 May 2013

Hello Brendan,

When there are no bars on the chart - there is no study calculation. Unfortunately there is no workaround for that.
You need to filter your instrument list and delete the symbols with no data. You can load all symbols into the market scanner to sort out the symbols with no data.

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

Re: Run code on chart with zero bars

Postby Henry MultiСharts » 23 May 2013

I use IQFeed. Is there any way of loading more than 500 symbols into a scanner? I don't need real-time data, just to know whether each symbol has data (a closing price).
There is no scanner limitation for the amount of symbols that can be used (in MC 64 bit).
1) You can extend your IQFeed account to allow loading more than 500 symbols simultaneously.
2) Load data for 500 symbols. Close your scanner, open a new one, load data for next 500 symbols.
If you want to view all of them at the same time-switch to offline mode and load all symbols in the scanner.
The real solution would be to have a new boolean reserved word: IsBarData which would be false if the chart contained no data.
Will not change anything as:
When there are no bars on the chart - there is no study calculation. Unfortunately there is no workaround for that.
Or some native means of exporting more than one symbol at a time to CSV (Excel) format.
You may want to submit a feature request to the Project Management of our web site so other users can vote for it: https://www.multicharts.com/pm/


Return to “MultiCharts”