Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 3/25/2006(UTC) Posts: 2
|
Hello guys
I'm creating a personalized indicator, in which I want to choose ARRAY type (e.g. Open, Close, High, Low)
I found here this simple solution
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
It works, but I don't want to choose between numbers, I want to choose directly the type to use, as the same as in the metastock built-in indicators, e.g. moving average.
Does anybody know how to do that?
Thanks
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
Rasputa,
The short answer is... you can't.
MS will only allow users to enter numeric data, and in fact works only with numeric data (there are no text data types, boolean data types etc that might be found in many other programing languages)
Jose originally started using the code you displayed (or at least I think it was him, its brilliant and works so we'll credit him with it anyway).
The only way to be able to choose from a list is to enumerate the list e.g.
OPEN=1
HIGH=2
LOW=3
CLOSE=4
etc
or maybe, slightly more advanced, but still enumerated
Mov(x,prd,S)=1
Mov(x,prd,E)=2
Mov(x,prd,W)=3
etc
BUT...
there are limits on how much you can tell the user, due to limitations on the length of the strings in the Input() function and the fact you are limited to only 6 Inputs() in any case.
I hope this helps.
wabbit :D
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 3/25/2006(UTC) Posts: 2
|
Now I hate MS! I'm joking.
Thanks Wabbit ... See ya
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.