Page 1 of 1

Data Series in Functions

Posted: May 11 2015
by shadrock55
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?

Re: Data Series in Functions  [SOLVED]

Posted: May 13 2015
by furytrader
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?

Re: Data Series in Functions

Posted: Jan 17 2017
by bomberone1
What could it serve you doing this for real trading? What kind of study and application could you get?