logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
WmWaster  
#1 Posted : Sunday, April 16, 2006 1:02:31 PM(UTC)
WmWaster

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/20/2006(UTC)
Posts: 53

Moving Averages of "Variable" Hi. I would like to set a indicator like the following: [color=red:de328b6530]Variable:=Input("Please enter a variable like C, V, MACD()");[/color] Mov(Variable, 25, E) However it won't work. What did I miss? #-o
wabbit  
#2 Posted : Sunday, April 16, 2006 1:49:20 PM(UTC)
wabbit

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)
The Input() function can only receive numeric values. To solve your situation, nest some If() statements to produce the desired result in the variable, e.g. x:=Input("Use 1=C, 2=V, 3=MACD()",1,3,1); x:=If(x=1,C,If(x=2,V,If(x=3,MACD(),0))); Mov(x, 25, E); Hope this helps. wabbit :D
WmWaster  
#3 Posted : Sunday, April 16, 2006 2:59:22 PM(UTC)
WmWaster

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/20/2006(UTC)
Posts: 53

wabbit wrote:
The Input() function can only receive numeric values. To solve your situation, nest some If() statements to produce the desired result in the variable, e.g. x:=Input("Use 1=C, 2=V, 3=MACD()",1,3,1); x:=If(x=1,C,If(x=2,V,If(x=3,MACD(),0))); Mov(x, 25, E); Hope this helps. wabbit :D
Does Metastock only accept numeric value? Is there any function which accepts string/text?
StorkBite  
#4 Posted : Sunday, April 16, 2006 4:09:49 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
You could use GV.dll to set and retrieve variables by string names, but it wouldn't serve to improve the example above. The input function only accepts numeric data.
WmWaster  
#5 Posted : Sunday, April 16, 2006 5:34:31 PM(UTC)
WmWaster

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/20/2006(UTC)
Posts: 53

g_stockman wrote:
You could use GV.dll to set and retrieve variables by string names, but it wouldn't serve to improve the example above. The input function only accepts numeric data.
Do you mean I can type the string and GV.dll will transfer it into numeric value? Sound good! Where can I get GV.dll? PS: I managed to get this file from http://www.metastocktools.com/ But it has no manual/instruction. How to use?
StorkBite  
#6 Posted : Monday, April 17, 2006 1:00:42 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
I mean that you can transfer numeric data into a variable with a string name outside of MS. Here is the syntax: ExtFml( "GV.Clear") ExtFml( "GV.GetVar", Variable Name) ExtFml( "GV.SetVar", Variable Name, Expression) There are several examples that use this code available here on the forum.
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.