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

Re: [EquisMetaStock Group] Plotting weekly data on daily price



PureBytes Links

Trading Reference Links

thanks roy, this new version of the weekly OHLC
compression doesn't use the "prev" function....that's
great

i hereby attached an older code from you ploting the
weekly bollinger bands onto daily charts....i was
wondering whetever you knew of/had a newer version of
this code not using the "prev" function ? 

{Weekly bb compression}
{Copyright© 2003 Roy Larsen}
{rlarsen@xxxxxxxxxxxxxx}
{use on daily charts}
D:=Input("Weeks",6,50,20);
G:=Input("Deviations",0,9,2);
I:=Input("0=SMA 1=EMA",0,1,0);
A:=DayOfWeek()=5;Q:=2/(D+1);
B:=DayOfWeek()<=Ref(DayOfWeek(),-1);
J:=If(A,1,If(Alert(A,2)=0 AND B,2,0));
K:=ValueWhen(1,J,If(J=1,C,Ref(C,-1)));
M:=(Cum(If(J,K,0))-ValueWhen(D+1,J,Cum(If(J,K,0))))/D;
N:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Q)+K*Q);
X:=Power(M-ValueWhen(1,J,K),2)+
Power(M-ValueWhen(2,J,K),2)+
Power(M-ValueWhen(3,J,K),2)+
Power(M-ValueWhen(4,J,K),2)+
Power(M-ValueWhen(5,J,K),2)+
Power(M-ValueWhen(6,J,K),2)+
(D>6)*Power(M-ValueWhen(7,J,K),2)+
(D>7)*Power(M-ValueWhen(8,J,K),2)+
(D>8)*Power(M-ValueWhen(9,J,K),2)+
(D>9)*Power(M-ValueWhen(10,J,K),2)+
(D>10)*Power(M-ValueWhen(11,J,K),2)+
(D>11)*Power(M-ValueWhen(12,J,K),2)+
(D>12)*Power(M-ValueWhen(13,J,K),2)+
(D>13)*Power(M-ValueWhen(14,J,K),2)+
(D>14)*Power(M-ValueWhen(15,J,K),2)+
(D>15)*Power(M-ValueWhen(16,J,K),2)+
(D>16)*Power(M-ValueWhen(17,J,K),2)+
(D>17)*Power(M-ValueWhen(18,J,K),2)+
(D>18)*Power(M-ValueWhen(19,J,K),2)+
(D>19)*Power(M-ValueWhen(20,J,K),2)+
(D>20)*Power(M-ValueWhen(21,J,K),2)+
(D>21)*Power(M-ValueWhen(22,J,K),2)+
(D>22)*Power(M-ValueWhen(23,J,K),2)+
(D>23)*Power(M-ValueWhen(24,J,K),2)+
(D>24)*Power(M-ValueWhen(25,J,K),2)+
(D>25)*Power(M-ValueWhen(26,J,K),2)+
(D>26)*Power(M-ValueWhen(27,J,K),2)+
(D>27)*Power(M-ValueWhen(28,J,K),2)+
(D>28)*Power(M-ValueWhen(29,J,K),2)+
(D>29)*Power(M-ValueWhen(30,J,K),2)+
(D>30)*Power(M-ValueWhen(31,J,K),2)+
(D>31)*Power(M-ValueWhen(32,J,K),2)+
(D>32)*Power(M-ValueWhen(33,J,K),2)+
(D>33)*Power(M-ValueWhen(34,J,K),2)+
(D>34)*Power(M-ValueWhen(35,J,K),2)+
(D>35)*Power(M-ValueWhen(30+6,J,K),2)+
(D>30+6)*Power(M-ValueWhen(30+7,J,K),2)+
(D>30+7)*Power(M-ValueWhen(30+8,J,K),2)+
(D>30+8)*Power(M-ValueWhen(30+9,J,K),2)+
(D>30+9)*Power(M-ValueWhen(40,J,K),2)+
(D>40)*Power(M-ValueWhen(40+1,J,K),2)+
(D>40+1)*Power(M-ValueWhen(40+2,J,K),2)+
(D>40+2)*Power(M-ValueWhen(40+3,J,K),2)+
(D>40+3)*Power(M-ValueWhen(40+4,J,K),2)+
(D>40+4)*Power(M-ValueWhen(40+5,J,K),2)+
(D>40+5)*Power(M-ValueWhen(40+6,J,K),2)+
(D>40+6)*Power(M-ValueWhen(40+7,J,K),2)+
(D>40+7)*Power(M-ValueWhen(40+8,J,K),2)+
(D>40+8)*Power(M-ValueWhen(40+9,J,K),2)+
(D>40+9)*Power(M-ValueWhen(50,J,K),2);
I:=If(I,N,M);
R:=G*Sqrt(X/D);
Y:=I+R;
Z:=I-R;
M;Y;Z;

--- Roy Larsen <rlarsen@xxxxxxxxxxxxxx> wrote:
> 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;
> 
> 
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html


 
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/