[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

> Thank you very much for your detailed examples.  I'll definitely play
> around with it some more using your instructions.  I was basically
> looking for the same thing as the original poster, ie. something
> similar to the Security() function (I'm running 7.03EOD).  I'm
> interested in building a simple relative strength
> indicator/exploration for a portfolio of stocks (eg. weekly/monthly
> ROC relative strength vs the S&P).  Do you think this can be
> accomplished using the DLL?

The GV.dll is well suited to what you want to do. Here's an example of an indicator you could use on
any preferred index to store daily and weekly index momentum. All of the complexity in this
indicator is there to provide options for the weekly momentum value. A bare-bones weekly momentum
would be simpler but what's the point of simplifying something that already works properly. If you
wanted monthly values as well (three different timeframes) then it would be a good idea to remove
the remove the fluff.

Both daily and weekly momentum values are saved as global variables and these index values can then
be called by an exploration and compared with equivalent values on each issue in your exploration.
For that you'd also need a slight variation on the indicator below ("Weekly Momentum" only plotting
'Y' and not storing global variables) to enable comparison of each issues weekly momentum against
the index momentum.

  {Index Momentum - Daily and Weekly}
  {© 2004 Roy Larsen, rlarsen@xxxxxxxxxxxxxx}
  {for use on daily charts with
   Jose Silva's "Calendar Week counter"}
N:=Input("Weekly Momentum Periods",1,99,10);
F:=Input("End of Week,  5=Friday  6=Saturday  7=Sunday",5,7,5);
Q:=Input("Display Mode,  0=Static  1=Dynamic  2=Test",0,2,2);
  {0=Display, update on Friday when possible}
  {1=Display, update on each new bar}
  {2=Backtest, update on first bar of new week}
G:=LastValue(Highest(Sum(DayOfWeek()=F,5))=5);
I:=Fml("Calendar Week counter");
I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0;
F:=G OR (DayOfWeek()=F AND I=0);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
K:=ValueWhen(1,K>0,K);
X:=Mo(N);
Y:=100*ValueWhen(1,J,K)/ValueWhen(N+1,J,K);
A:=ExtFml("GV.SetVar","DailyMo",X);
A:=ExtFml("GV.SetVar","WeeklyMo",Y);
X;Y;

Typical exploration columns for the four momentum values (making no comparisons) would look like
this. Obviously you would want to include some comparisons.

You could not use the above indicator for both the index and individual issues as as calling it for
each issue would refresh the "DailyMo" and "WeeklyMo" global variables with incorrect (individual
issue) values. However as long as the indicator is only dropped ont an index chart then deleted and
not called again the gloval varibles will remain set for that index until the end of the MetaStock
session. One feature of using the global variable dll is that you can save any number of data
arrays, each with a different name, and call them at will.

Column A: {Idx Mo}
IdxDailyMo:=ExtFml("GV.GetVar","DailyMo");

Column B: {Idx WkMo}
IdxWeeklyMo:=ExtFml("GV.GetVar","WeeklyMo");

Column C: {Daily Mo}
DailyMo:=Mo(10)

Column D: {Wkly Mo}
WeeklyMo:=Fml("Weekly Momentum");


Hope this gives you some ideas.

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/