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

[amibroker] Re: Krausz Bands Conversion from MS



PureBytes Links

Trading Reference Links

Greg
Thanks for your work.

I'm not that proficient at programming AB, however, I have some 
suggestions that might make your code a little more efficient (avoid 
repeateing unnecessary lines, and changing the IIF statements - which 
perhaps someone more familiar with the use of the "equal" sign might 
confirm.  Here is my suggestion...

_SECTION_BEGIN("Krausz Bands Weekly");
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);

//Upper Krausz Band
RR2=DwP+(Wr*.618);

//LowerBand;
SR2=DwP-(Wr*.618);
TimeFrameRestore();

Plot(TimeFrameExpand
(rr2,inWeekly,expandFirst),"rr2",colorRed,styleLine);
Plot(TimeFrameExpand
(SR2,inWeekly,expandFirst),"rr2",colorBlue,styleLine);
Plot(C,"",colorGreen,64);
_SECTION_END();

Rick
--- In amibroker@xxxxxxxxxxxxxxx, "Greg" <gregbean@xxxx> wrote:
> 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 ----- 
>   From: Greg 
>   To: AmiBroker@xxxxxxxxxxx 
>   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 Investment management software  Investment 
property software  Investment software  
>         Investment tracking software  Return on investment 
software  Stock investment software  
> 
> 
> --------------------------------------------------------------------
----------
>   YAHOO! GROUPS LINKS 
> 
>     a..  Visit your group "amibroker" on the web.
>       
>     b..  To unsubscribe from this group, send an email to:
>      amibroker-unsubscribe@xxxxxxxxxxxxxxx
>       
>     c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of Service. 
> 
> 
> --------------------------------------------------------------------
----------




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/