Collecting data from all symbols in DataSet and printing after they are processed
Author: namuh
Creation Date: 9/19/2012 1:31 PM
profile picture

namuh

#1
Hello All, I didn't find this in a search mainly because I probably did not have refined enough keywords... that is if it's there.

I have a script that processes a data set with a number of symbols. For each symbol it calculates a value based on some statistics over the bars of the Symbol. What I don't know how to do is to accumulate, for instance, a sum of those values and print it out (in the Debug Window) after all the symbols have been processed. Since the Execute code runs once for each symbol, I don't see a way to capture persistent data between symbols or to post process it after the last instance of Execute has run to process the last symbol in the set.

any help appreciated.
profile picture

Eugene

#2
There are different ways, one of them keeping the sum in a class-level variable or, like code below will illustrate, you could have it done with DataSetSymbols:

CODE:
Please log in to see this code.
profile picture

namuh

#3
That worked. Thanks very much!
profile picture

Eugene

#4
Glad to help.
profile picture

Cone

#5
I'd run that with SetContext( DataSetSymbols[ds], false );

It will run faster because each symbol is not going to be synch'd with the clicked symbol, which is what you actually want - analyze the raw data for each symbol's Bars object.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).