PureBytes Links
Trading Reference Links
|
Vinit
> HI can any ine tellme how i can display the 3 day simple moving
> average of the high of weekly data on daily data. And the same for
> the lows
> THanks in advance
Jose has already pointed you to one link with a Weekly SMA for daily charts. However that is written
to provide an SMA of the weekly CLOSE. You will need to marry some code from the Weekly OHLC
indicator to the Weekly SMA indicator to get the SMA of Weekly HIGH and Weekly LOW.
Here are all of the relevant indicators with the necessary changes already made. Note that 'K' is
the only variable that differs between the three SMA indicators. These are almost direct copies from
the 'Hw' and 'Lw' variables in Weekly OHLC - only the names of 'Hw' and 'Lw' have been changed.
Roy
{Weekly OHLC}
{Copyright© 2003 Roy Larsen}
{rlarsen@xxxxxxxxxxxxxx}
{use on daily charts}
Q:=Input("Dynamic Current Week?",0,1,1);
{0=Update when end of current week is known}
{1=MS compatible dynamic current week}
M:=DayOfWeek()<=ValueWhen(2,1,DayOfWeek());
F:=DayOfWeek()=5;
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,1,(B=0)*J);
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2,1,Lw)));
Cw:=ValueWhen(1,J,If(J=1,C,ValueWhen(2,1,C)));
Ow:=ValueWhen(1,J,If(J=1,ValueWhen(1,M,O),
ValueWhen(2,M OR Cum(1)=3,O)));
Ow:=ValueWhen(1,Lw>0,Ow); {O}
Hw:=ValueWhen(1,Lw>0,Hw); {H}
Lw:=ValueWhen(1,Lw>0,Lw); {L}
Cw:=ValueWhen(1,Lw>0,Cw); {C}
Ow; Hw; Lw; Cw;
{Weekly SMA - Close}
{Copyright© 2003 Roy Larsen}
{rlarsen@xxxxxxxxxxxxxx}
{use on daily charts}
D:=Input("Periods in Weeks",1,100,10);
Q:=Input("Dynamic Current Week?",0,1,1);
{0=Update when end of current week is known}
{1=MS compatible dynamic current week}
M:=DayOfWeek()<=ValueWhen(2,1,DayOfWeek());
F:=DayOfWeek()=5;
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,1,(B=0)*J);
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2,1,C)));
G:=Cum((J>0)*K);
X:=(G-ValueWhen(D+1,J,G))/D;
X;
{Weekly SMA - High}
{Copyright© 2004 Roy Larsen}
{rlarsen@xxxxxxxxxxxxxx}
{use on daily charts}
D:=Input("Periods in Weeks",1,100,3);
Q:=Input("Dynamic Current Week?",0,1,1);
{0=Update when end of current week is known}
{1=MS compatible dynamic current week}
M:=DayOfWeek()<=ValueWhen(2,1,DayOfWeek());
F:=DayOfWeek()=5;
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,1,(B=0)*J);
K:=HighestSince(1,M,H);
K:=ValueWhen(1,J,If(J=1,K,ValueWhen(2,1,K)));
G:=Cum((J>0)*K);
X:=(G-ValueWhen(D+1,J,G))/D;
X;
{Weekly SMA - Low}
{Copyright© 2004 Roy Larsen}
{rlarsen@xxxxxxxxxxxxxx}
{use on daily charts}
D:=Input("Periods in Weeks",1,100,3);
Q:=Input("Dynamic Current Week?",0,1,1);
{0=Update when end of current week is known}
{1=MS compatible dynamic current week}
M:=DayOfWeek()<=ValueWhen(2,1,DayOfWeek());
F:=DayOfWeek()=5;
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,1,(B=0)*J);
K:=LowestSince(1,M,L);
K:=ValueWhen(1,J,If(J=1,K,ValueWhen(2,1,K)));
G:=Cum((J>0)*K);
X:=(G-ValueWhen(D+1,J,G))/D;
X;
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|