# Data Series in Functions  [SOLVED]

Questions about MultiCharts and user contributed studies.
Posts: 47
Joined: 24 Feb 2011
Location: Atlanta, GA
Has thanked: 5 times
Been thanked: 8 times

### Data Series in Functions

I want to know is there any easy way to save your own data series into an array and feed it to function instead of a built in price series. Here is an example of what I mean.

Current Psuedo Code:

Code: Select all

``` Value1 = BollingerBand (Close, 50, 2); ```
New Pseudo Code:

Code: Select all

``` Arrays: CalcClose[50](0); {Save a Series of values into the Array} For Value65 = 50 down 1 begin CalcClose[Value65 + 1] = CalcClose[Value65]; End; CalcClose[1] = Close + Random(10) {Calculate the BollingerBand based on the values in the array} Value1 = BollingerBand (CalcClose, 50, 2); ```
1. Would this work?
2. Would it work right if I changed the Bollinger Band's price series function to NumericArray?
3. Is there an easy way to do this without rewriting the entire series of functions that are used to calculate BollingerBands?

Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

### Re: Data Series in Functions  [SOLVED]

It wouldn't work as an array, but if you made CalcClose a simple numeric variable that you updated with each price bar, it should work.

For example:

Code: Select all

```Vars: CalcClose(0); CalcClose = Close + Random(10); // This could be any value Value1 = BollingerBand (CalcClose, 50, 2);```
This compiles without error, although I haven't placed it on a chart. Note that you don't need to use an array here, as the CalcClose value is organized into a collection coincident with the underlying price data.

Does this accomplish what you're looking to do?

bomberone1
Posts: 200
Joined: 02 Nov 2010
Has thanked: 14 times
Been thanked: 13 times

### Re: Data Series in Functions

What could it serve you doing this for real trading? What kind of study and application could you get?