array input

Questions about MultiCharts and user contributed studies.
fibdax
Posts: 155
Joined: 03 Jan 2011
Has thanked: 10 times
Been thanked: 6 times

array input

Postby fibdax » 14 Apr 2011

I have this statement, (( Array:IntraBarPersist Days[120,1](0); )) and I would like the number 120 was an input.
is it possible? I tried to do
input: dayss(120)
Array:IntraBarPersist Days[dayss,1](0);


but does not work.
thanks
Last edited by fibdax on 14 Apr 2011, edited 1 time in total.

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 302 times

Re: array input

Postby Stan Bokov » 14 Apr 2011

No, the compiler will not allow you to do that.

fibdax
Posts: 155
Joined: 03 Jan 2011
Has thanked: 10 times
Been thanked: 6 times

Re: array input

Postby fibdax » 14 Apr 2011

I have seen, there is a correct way to do this'?

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: array input

Postby janus » 14 Apr 2011

I have seen, there is a correct way to do this'?
You could use a simple numeric variable as input, and use that to resize a dynamic array. The only restriction is it has to be a 1-dimensional array, not 2 as you appear to be using. So, if you can relax that condition, you could use something like:

inputs: array1.size(10);
arrays: IntraBarPersist array1[](0);
once array_setmaxindex(array1,array1.size);


Return to “MultiCharts”