[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Metastockusers] Re: Reference to another security



PureBytes Links

Trading Reference Links

Alex

There's no formal instructions that I know of. There are three commands for the GlobalVar dll

ExtFml( "GlobalVar.Clear");
ExtFml( "GlobalVar.GetVar", "Variable Name");
ExtFml( "GlobalVar.SetVar", "Variable Name", Expression);

Clear will clear ALL global variables held by GlobalVar.dll and this can be counter productive. I
never use it. However because these variables can (and do) come up in an unknown state it certainly
pays to Set (usually to zero) before Get. This can mean calling an indicator containing the global
var before using it in an exploration, say, or dropping  a reset indicator onto a chart to clear all
variables before use.

Using like so in an indicator will create a plot of "Expression" as well as saving "Expression" as
"Variable Name" in the GlobalVar.dll workspace
ExtFml( "GlobalVar.SetVar", "Variable Name", Expression);

To avoid an unwanted plot you can use a standard variable name like so
A:=ExtFml( "GlobalVar.SetVar", "Variable Name", Expression);

However you must remember that "A" as a standard variable name is still subject to the normal 20
variable name limitation. There is no such limitation on the global variable names. You can save
several different global variables for the price of one standard variable name like so
A:=ExtFml( "GlobalVar.SetVar", "Variable Name", Expression 1);
A:=ExtFml( "GlobalVar.SetVar", "Variable Name", Expression 2);
...
A:=ExtFml( "GlobalVar.SetVar", "Variable Name", Expression 99);
A:=ExtFml( "GlobalVar.SetVar", "Variable Name", Expression 100);

Repeating "GlobalVar" many times over will in itself use up a lot of space. Therefore it is a good
idea to use a copy of GlobalVar.dll with a much shorter name. I use GV.dll as in the following
examples taken directly from the "Trade Equity GV LE" indicator. Also keep GV variable names short
to conserve space.

I:=ExtFml("GV.SetVar","I",I);
I:=ExtFml("GV.SetVar","N",N);
I:=ExtFml("GV.SetVar","X",X);
I:=ExtFml("GV.SetVar","Cn",Cn);
I:=ExtFml("GV.SetVar","Cp",Cp);
I:=ExtFml("GV.SetVar","Cx",Cx);

Here's an example of an indicator I use to reset some global variables before running a series of
optimising explorations with Trade Equity. "OptA" and "OptB" are used as counters during the
explorations and they are reset to zero by dropping the indicator onto any chart. "OptX" is set by
the user to the number of issues in each exploration. Then "OptA" and "OptX" are plotted to give a
visual reminder that the indicatoris present. Deleting the indicator and then dropping it down aagin
will reset the global variables again.

  {Trade Equity GV Opt Setup}
  {© 2004 Roy Larsen, rlarsen@xxxxxxxxxxxxxx}
  {use this indicator on chart to set and plot
   the number of issues in each TE exploration}
N:=Input("Number of Issues",1,9999,500);
A:=ExtFml("GV.SetVar","OptA",0);
A:=ExtFml("GV.SetVar","OptB",0);
A:=ExtFml("GV.SetVar","OptX",N);
ExtFml("GV.GetVar","OptA");
ExtFml("GV.GetVar","OptX");


Each TE Optimising exploration has the following code placed ahead of the normal column A code, and
this is where the counters are incremented.

{Column A: $ Profit}
  {Set up options counters}
OptA:=LastValue(ExtFml("GV.GetVar","OptA"));
OptB:=LastValue(ExtFml("GV.GetVar","OptB"));
OptX:=LastValue(ExtFml("GV.GetVar","OptX"));
A:=(OptB/OptX)=Int(OptB/OptX) AND OptB<>0;
B:=ExtFml("GV.SetVar","OptB",OptB+1);
B:=ExtFml("GV.SetVar","OptA",OptA+A);


The following comments and code relate to modifying entry and/or exit indicators used by Trade
Equity so that the global variable counters are used to change selected vaulues for each exploration
run.

  {Trade Equity GV Opt Insert}
  {use code as part of your entry or exit code
   to set initial and increment option values}
  {where "X" is the option initial value}
  {where "Y" is the option increment value}

OptA:=LastValue(ExtFml("GV.GetVar","OptA"));
OptA:=X + OptA/Y;

  {example of option use}
  {standard entry}
Entry:=Cross(Mov(C,15,E),Mov(C,30,E));
Entry;

  {modified entry using optional values}
OptA:=LastValue(ExtFml("GV.GetVar","OptA"));
OptA:=10 + OptA/1;
Entry:=Cross(Mov(C,OptA,E),Mov(C,30,E));
Entry;


As you can see there are a number of things that you can do with these global variables. I can't
possibly show you every possibility but I can help you set up whatever it is that you want to do. If
you're like most people I suspect you've already thrown up your hands in horror, but if you're still
with me let me know if you need any further help.

Roy




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com.  Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/Metastockusers/

<*> To unsubscribe from this group, send an email to:
     Metastockusers-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/