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

Notification

Icon
Error

Options
Go to last post Go to first unread
Gregor  
#1 Posted : Thursday, May 12, 2011 1:08:14 PM(UTC)
Gregor

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 6/12/2007(UTC)
Posts: 32

Can you have global varaibles?

I have a band trading system where I can manaully set the band parameters for a chart. The system also has indicator with band parameter that must be manaully set to the same level as the chart's. I want to know if its possible using global variables, when setting the chart band parameters they will automatically apply to all indicators as well.

Below are the band parmaters am using in chart & indicators - "x", "y" and "a"

x:=Input("Short Term Moving Average",7,14,7);
y:=Input("Envelopes Percentage variation",1,30,5)/100;
a:=x*5;

Mov(C,x,E);
Mov(C,x,S)*(1+y);
Mov(C,x,S)*(1-y);
Mov(C,a,E);

Gregor

mstt  
#2 Posted : Thursday, May 12, 2011 1:52:44 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Gregor After setting global variable values via Input() functions in one indicator (SetVar GV function), you should only need to refresh the current chart in order to apply the new GV values to other indicators. One indicator needs to be the "master" and the others "slaves". That is, one indicator writes (SetVar) the required parameter values and all others read or (GetVar) those values. Indicators reading the GV values would need to apply LastValue() to them so they could be used as Periods parmeters. Roy
wabbit  
#3 Posted : Thursday, May 12, 2011 2:16:02 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)
You can also use FmlVar(). wabbit [:D]
jjstein  
#4 Posted : Thursday, May 12, 2011 5:38:40 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Roy -- Might want to let him know where to download GV.DLL and any docs...


mstt  
#5 Posted : Thursday, May 12, 2011 6:56:24 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Jonathan/Gregor If I've got the link right the GlobalVar DLL can be downloaded from www.metastocktips.co.nz/GV.dll. If the link doesn't appear correctly then write to me at rlarsen@quik.co.nz. Roy
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.