Well, well, well. I surprised myself and converted
it myself.
Here it is. My first contribution to the group, I
think.
_SECTION_BEGIN ("Krausz
Bands Weekly");
//upperband;
TimeFrameSet (inWeekly);
Dw= IIf(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
HighestSince ( Cross( MACD(), 0 ), Close, 1 );
Wt= IIf(Dw=1,
(Ref(HighestSince(Dw=1,H,1),-1)+
Ref(LowestSince(Dw=1,L,1),-1) + Ref(C,-1))/3,0);
Wh= IIf(Dw=1,Ref(HighestSince(Dw=1,H,1),-1),0);
Wl= IIf(Dw=1,Ref(LowestSince(Dw=1,L,1),-1),0);
Wr= ValueWhen(Wh>0,Wh,1)-ValueWhen(Wl>0,Wl,1);
DwP= ValueWhen(Wt>0,Wt,1);
RR2=DwP+(Wr*.618);
RR2;
TimeFrameRestore ();
Plot (TimeFrameExpand(rr2,inWeekly,expandFirst),"rr2",colorRed,styleLine);
//LowerBand;
TimeFrameSet (inWeekly);
Dw= IIf(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
Wt= IIf(Dw=1,(Ref(HighestSince(Dw=1,H,1),-1)+ Ref(LowestSince(Dw=1,L,1),-1) +
Ref(C,-1))/3,0);
Wh= IIf(Dw=1,Ref(HighestSince(Dw=1,H,1),-1),0);
Wl= IIf(Dw=1,Ref(LowestSince(Dw=1,L,1),-1),0);
Wr= ValueWhen(Wh>0,Wh,1)-ValueWhen(Wl>0,Wl,1);
DwP= ValueWhen(Wt>0,Wt,1);
SR2=DwP-(Wr*.618);
SR2;
TimeFrameRestore ();
Plot (TimeFrameExpand(SR2,inWeekly,expandFirst),"rr2",colorBlue,styleLine);
_SECTION_END ();
----- Original Message -----
Sent: Thursday, August 25, 2005 11:30
AM
Subject: [amibroker] Krausz Bands
Conversion from MS
Hello,
Is anyone able to translate the Metastock
formula below to produce the Krausz Bands in Amibroker.
The link below shows them as weekly support and
resistance lines plotted on a daily chart.
http://www.cedarcreektrading.com/Charts/chart7.gif
Thanks to anyone who will tackle this.
Greg
--------------------------------------------------
Upper Krausz Band
Dw:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
Wt:=If(Dw=1,
{then}(Ref(HighestSince(1,Dw=1,H),-1)+
Ref(LowestSince(1,Dw=1,L),-1) +
Ref(C,-1))/3,
{else}0);
Wh:=If(Dw=1,
{then}Ref(HighestSince(1,Dw=1,H),-1),
{else}0);
Wl:=If(Dw=1,
{then}Ref(LowestSince(1,Dw=1,L),-1),
{else}0);
Wr:=ValueWhen(1,Wh>0,Wh)-ValueWhen(1,Wl>0,Wl);
DwP:=ValueWhen(1,Wt>0,Wt);
RR2:=DwP+(Wr*.618);
RR2;
--------------------------------------------------------------
Lower Krausz Band
Dw:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
Wt:=If(Dw=1,
{then}(Ref(HighestSince(1,Dw=1,H),-1)+
Ref(LowestSince(1,Dw=1,L),-1) +
Ref(C,-1))/3,
{else}0);
Wh:=If(Dw=1,
{then}Ref(HighestSince(1,Dw=1,H),-1),
{else}0);
Wl:=If(Dw=1,
{then}Ref(LowestSince(1,Dw=1,L),-1),
{else}0);
Wr:=ValueWhen(1,Wh>0,Wh)-ValueWhen(1,Wl>0,Wl);
DwP:=ValueWhen(1,Wt>0,Wt);
SR2:=DwP-(Wr*.618);
SR2;
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS
|