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

Re: [Metastockusers] WEEKLY INDICATOR



PureBytes Links

Trading Reference Links

Hi Norman


Your definitions for weekly HIGH and LOW are wrong. I think you
copied from the weekly CLOSE, but the HIGH and LOW have to
be calculated differently. See my Weekly OHLC formula.

The following two lines in my code are purely to remove distorting zero
values at the left side of the chart. They inhibit any zero plot for the
weekly high or low.

Hw:=ValueWhen(1,Hw>0,Hw);
Lw:=ValueWhen(1,Lw>0,Lw);

Try this formula and see what it looks like. I've changed the "Q" variable
default so you get a dynamic plot for the current week.

N:=Input("Weekly Periods",1,99,13); 
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,1);
  {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));
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2-G,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2-G,1,Lw)));
Hw:=ValueWhen(1,Hw>0,Hw);
Lw:=ValueWhen(1,Lw>0,Lw);
H1:=ValueWhen(2,J,Hw);
L1:=ValueWhen(2,J,Lw);
A:=If(Hw>H1,Hw-H1,0);
B:=If(Lw<L1,L1-Lw,0);
X:=Cum((J>0)*A); 
X:=(X-ValueWhen(N+1,J,X))/N;
Y:=Cum((J>0)*B);
Y:=(Y-ValueWhen(N+1,J,Y))/N;
X/(X+Y);

Kind regards

Roy
www.metastocktips.co.nz




----- Original Message ----- 
From: "ruagoodp" <almutwinter@xxxxxx>
To: <Metastockusers@xxxxxxxxxxxxxxx>
Sent: Thursday, May 26, 2005 9:24 AM
Subject: [Metastockusers] WEEKLY INDICATOR


> Hi Roy,
> 
> Try again:
> 
> 
> N:=Input("Weekly RSI - Close Periods",1,99,13); Pc:=1/N;
> 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,H,ValueWhen(2-G,1,H)));
> K:=ValueWhen(1,K>0,K);
> K1:=ValueWhen(1,J,If(J=1,L,ValueWhen(2-G,1,L)));
> K1:=ValueWhen(1,K1>0,K1);
> Ua:=ValueWhen(1,J>0,K); Da:=ValueWhen(2,J>0,K);
> Ua1:=ValueWhen(1,J>0,K1); Da1:=ValueWhen(2,J>0,K1);
> Ub:=If(Ua>Da,Ua-Da,0); Db:=If(Ua1<Da1,Da1-Ua1,0);
> A:=Cum((j>0)*Ub);
> B:=Cum((j>0)*Db);
> 
> X:=(A-ValueWhen(N+1,J,A))/N;
> Y:=(B-ValueWhen(N+1,J,B))/N;
> X/X+Y
> 
> Its beginning to look like the original indicator if I invert the Y scale!
> 
> Norman
> 
> 
> 
> 
> 
> 
> --------------------------------------------------------------------------------
> Yahoo! Groups Links
> 
>  a.. To visit your group on the web, go to:
>  http://groups.yahoo.com/group/Metastockusers/
>    
>  b.. To unsubscribe from this group, send an email to:
>  Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
>    
>  c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
> 
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/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/