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

Re: [EquisMetaStock Group] Question for Roy : "Weekly Bollinger Bands"



PureBytes Links

Trading Reference Links

Hi Marco


> I would like to know if the "Weekly Bollinger Bands" that you've
> marvelously crafted are calculated using the Typical Price ( (H+L+C)/3 )
> for the SMA 20 (as John Bollinger suggests).

I used the CLOSE I think.

> If not, is it feasible ?

Typical Price, Mean Price, and Weighted Close are all possibilities. Change the last definition of 
the "K" variable (where weekly CLOSE becomes weekly TP()) if you want to try one of the other 
possibilities.

> Thanks in advance for your invaluable help,

No problem (except time).


Kind regards

Roy



  {Weekly Bollinger Bands - SMA/TP}
  {2005 Roy Larsen}
  {use on daily charts with Jose Silva's
  "Calendar Week counter"}
N:=Input("Weekly Bollinger Band Periods - SMA",1,30,20);
D:=Input("Standard Deviations",0,9,2);
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=Update on Friday when possible}
  {1=Update on each new bar}
  {2=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+(I>0);
F:=G+(DayOfWeek()=F AND I=0);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=ValueWhen(2,1,A);
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);
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2-G,1,Hw)));
Hw:=ValueWhen(1,Hw>0,Hw);
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2-G,1,Lw)));
Lw:=ValueWhen(1,Lw>0,Lw);
K:=(K+Hw+Lw)/3;
M:=(Cum(If(J,K,0))-ValueWhen(N+1,J,Cum(If(J,K,0))))/N;
N1:=LastValue((N>10)*10);
N2:=LastValue((N>20)*20);
X:=Power(M-ValueWhen(1,J,K),2)+
(N>1)*Power(M-ValueWhen(2,J,K),2)+
(N>2)*Power(M-ValueWhen(3,J,K),2)+
(N>3)*Power(M-ValueWhen(4,J,K),2)+
(N>4)*Power(M-ValueWhen(5,J,K),2)+
(N>5)*Power(M-ValueWhen(6,J,K),2)+
(N>6)*Power(M-ValueWhen(7,J,K),2)+
(N>7)*Power(M-ValueWhen(8,J,K),2)+
(N>8)*Power(M-ValueWhen(9,J,K),2)+
(N>9)*Power(M-ValueWhen(10,J,K),2)+
(N>10)*Power(M-ValueWhen(N1+1,J,K),2)+
(N>11)*Power(M-ValueWhen(N1+2,J,K),2)+
(N>12)*Power(M-ValueWhen(N1+3,J,K),2)+
(N>13)*Power(M-ValueWhen(N1+4,J,K),2)+
(N>14)*Power(M-ValueWhen(N1+5,J,K),2)+
(N>15)*Power(M-ValueWhen(N1+6,J,K),2)+
(N>16)*Power(M-ValueWhen(N1+7,J,K),2)+
(N>17)*Power(M-ValueWhen(N1+8,J,K),2)+
(N>18)*Power(M-ValueWhen(N1+9,J,K),2)+
(N>19)*Power(M-ValueWhen(N1+10,J,K),2)+
(N>20)*Power(M-ValueWhen(N2+1,J,K),2)+
(N>21)*Power(M-ValueWhen(N2+2,J,K),2)+
(N>22)*Power(M-ValueWhen(N2+3,J,K),2)+
(N>23)*Power(M-ValueWhen(N2+4,J,K),2)+
(N>24)*Power(M-ValueWhen(N2+5,J,K),2)+
(N>25)*Power(M-ValueWhen(N2+6,J,K),2)+
(N>26)*Power(M-ValueWhen(N2+7,J,K),2)+
(N>27)*Power(M-ValueWhen(N2+8,J,K),2)+
(N>28)*Power(M-ValueWhen(N2+9,J,K),2)+
(N>29)*Power(M-ValueWhen(N2+10,J,K),2);
Sd:=D*Sqrt(X/N);
M;{centre MA}
M+Sd;{top band}M-Sd;{bottom band} 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
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/