# A list of number in variable: Wath type of variable?  [SOLVED]

Questions about MultiCharts and user contributed studies. arjfca
Posts: 1283
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

### A list of number in variable: Wath type of variable?

Hello

In a function, I want to create a list of numbers separated by a comma like

Alist=(1.2345,1.2356,1.2367,1.2389) What kind of variable should I declare. It can't be a number since a comma will separate the list.

I could declare the list as a string, then use a Str2Num, but if there is another way, i would use it

I want to use these number ( alist) in a maxlist(alist).

Is it possible to not define my variable list as a string?

Martin

TJ
Posts: 7232
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

### Re: A list of number in variable: Wath type of variable?

Hello

In a function, I want to create a list of numbers separated by a comma like

Alist=(1.2345,1.2356,1.2367,1.2389) What kind of variable should I declare. It can't be a number since a comma will separate the list.

I could declare the list as a string, then use a Str2Num, but if there is another way, i would use it

I want to use these number ( alist) in a maxlist(alist).

Is it possible to not define my variable list as a string?

Martin
How you go about making this function depends on
what, where, and how you want to use the end result. arjfca
Posts: 1283
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

### Re: A list of number in variable: Wath type of variable?

Hello

In a function, I want to create a list of numbers separated by a comma like

Alist=(1.2345,1.2356,1.2367,1.2389) What kind of variable should I declare. It can't be a number since a comma will separate the list.

I could declare the list as a string, then use a Str2Num, but if there is another way, i would use it

I want to use these number ( alist) in a maxlist(alist).

Is it possible to not define my variable list as a string?

Martin
How you go about making this function depends on
what, where, and how you want to use the end result.
Hello TJ

The end result to be use in a MaxList function

MaxList(Value1,Value2,Value3... etc). The Number of iteration of Value(x) to be defined by an input value

So my variable as to be a list like alist=(1.2345,1.2356,1.2378)

Hope I'm clearer

Martin

TJ
Posts: 7232
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

### Re: A list of number in variable: Wath type of variable?

Hello TJ

The end result to be use in a MaxList function

MaxList(Value1,Value2,Value3... etc). The Number of iteration of Value(x) to be defined by an input value

So my variable as to be a list like alist=(1.2345,1.2356,1.2378)

Hope I'm clearer

Martin
You don't need to create a function, you can simply add the variables directly to Maxlist. arjfca
Posts: 1283
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

### Re: A list of number in variable: Wath type of variable?

Good day TJ

The number of variable is to be defined by a an Input value

What I want to do.

I'm defining and show a bar that as depict an increase of volatility. To do so, I compare body's of previous bar. If the actual body is greater than (x) numbers of body bar before, then this bar
is a Wide Range Bady ( WRB)

Actually, my code is hard coded to look for the previous 3 bars like
If Body is > Maxlist(Body,Body,Body) then WRB = True

Now, I want to modify my code so it would be flexible in the numbers of bar ago I want to check. To do so, my idea was to build my data string instead of hard coded one like I actually do.

Martin

TJ
Posts: 7232
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

### Re: A list of number in variable: Wath type of variable?  [SOLVED]

Good day TJ

The number of variable is to be defined by a an Input value

What I want to do.

I'm defining and show a bar that as depict an increase of volatility. To do so, I compare body's of previous bar. If the actual body is greater than (x) numbers of body bar before, then this bar
is a Wide Range Bady ( WRB)

Actually, my code is hard coded to look for the previous 3 bars like
If Body is > Maxlist(Body,Body,Body) then WRB = True

Now, I want to modify my code so it would be flexible in the numbers of bar ago I want to check. To do so, my idea was to build my data string instead of hard coded one like I actually do.

Martin
You can do this:

Code: Select all

```input: Look.back(3); Var: WRB(false); WRB = Body > Highest( Body, Look.back );```