PureBytes Links
Trading Reference Links
|
Subject: RE: [amibroker] Re: Laguerre RSI
Indicator
<FONT face=Arial color=#0000ff
size=2>Ron,
it can
be recreated with loops. Here is an attempt that may (or may not approximate the
MS version) but should at least offer you a framework from which to
begin...compare to your MS version and see how they
compare....
Regards,
Jayson
<FONT
color=#282828 size=2>
g=<FONT face=Arial
color=#0000ff size=2>0.5<FONT face=Arial
color=#0000ff>;
L0[<FONT
color=#0000ff>0]=<FONT
size=2>0;<FONT color=#008000
size=2>//initialize values to
zero
L1[<FONT
color=#0000ff>0]=<FONT
size=2>0<FONT face=Arial
color=#0000ff>;
L2[<FONT
color=#0000ff>0]=<FONT
size=2>0<FONT face=Arial
color=#0000ff>;
L3[<FONT
color=#0000ff>0]=<FONT
size=2>0<FONT face=Arial
color=#0000ff>;
<FONT
color=#800000 size=2>
for<FONT
color=#0000ff>( i=1<FONT
size=2>;i<BarCount;i++)<FONT
size=2> <FONT face=Arial
color=#0000ff>//loop through all bars<FONT color=#282828
size=2>
{
L0[i]= (<FONT
color=#0000ff>1-g)*<FONT
size=2>Close<FONT
size=2>[i] + (g*L0[i-1<FONT
size=2>]);
L1[i]= <SPAN
class=468063915-09122003>-g*L0[i] + L0[i-<FONT
face=Arial>1] +
(g*L1[i-1<FONT color=#282828
size=2>]);
L2[i]= -g*L1[i] + L1[i-<FONT
face=Arial>1] +
(g*L2[i-1<FONT color=#282828
size=2>]);
L3[i]= -g*L2[i] + L2[i-<FONT
face=Arial>1] +
(g*L3[i-1<FONT color=#282828
size=2>]);
}
cu= <FONT
color=#0000ff>IIf(L0>L1, L0-L1,<FONT
size=2>0) +IIf<FONT
size=2>(L1>L2, L1-L2,0) +
IIf(L2>L3, L2-L3,<FONT
size=2>0<FONT face=Arial
color=#0000ff>);
cd= <FONT
color=#0000ff>IIf(L0<L1, L1-L0,<FONT
size=2>0) + IIf<FONT
size=2>(L1<L2, L2-L1,0) +
IIf(L2<L3, L3-L2,<FONT
size=2>0<FONT face=Arial
color=#0000ff>);
temp= <FONT
color=#0000ff>IIf(cu+cd==<FONT
size=2>0, -1<FONT
color=#282828 size=2>,cu+cd);
x=<FONT
color=#0000ff>IIf(temp==-<FONT
size=2>1,0<FONT
color=#282828 size=2>,cu/temp);
<FONT
color=#0000ff size=2>
Plot<FONT color=#282828
size=2>(x,""<FONT color=#282828
size=2>,4<FONT color=#282828
size=2>);
//to
see values in exploration
Filter<FONT
color=#0000ff>=C<FONT
size=2>>0<FONT color=#282828
size=2>;<FONT color=#0000ff
size=2>
AddColumn<FONT
color=#282828 size=2>(L0,<FONT color=#ff00ff
size=2>"L0"<FONT
face=Arial>);
AddColumn<FONT
color=#282828 size=2>(L1,"L1"<FONT
color=#282828 size=2>);AddColumn<FONT
color=#282828 size=2>(L2,"L2"<FONT
color=#282828 size=2>);AddColumn<FONT
color=#282828 size=2>(L3,<FONT color=#ff00ff
size=2>"L3"<FONT
face=Arial>);
AddColumn<FONT
color=#282828 size=2>(Cu,<FONT color=#ff00ff
size=2>"CU"<FONT
face=Arial>);
AddColumn<FONT
color=#282828 size=2>(Cd,"Cd"<FONT
color=#282828 size=2>);
<FONT face=Tahoma
size=2>-----Original Message-----From: rck1135
[mailto:rkrebs@xxxxxxxxxxxxx]Sent: Tuesday, December 09, 2003 10:32
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re:
Laguerre RSI IndicatorThanks to Ara, Graham and Jayson
for your responses to my post re the Laguerre RSI indicator.
Obviously, the MS code is vastly different than the AFL language, but the
result is plotted by the 'IF' statement in the last line; If temp is equal
to -1 then display a '0' otherwise display the value of 'cu divided by
temp'. The trick in this formula is to duplicate the MS 'Prev'
function and I appreciate the references to past posts on this
subject. The 'Prev' constant allows one to create self-referencing
formulas - one that is able to reference the previous period's value of
itself. Example:((H+L+C)/3)+PREVthe formula divides the High, Low
and Close price by 3 and then adds this value to Yesterday's value of the
((H+L+C)/3). One wouls assume that the PREV function could be readily
replace by the AB Ref() function, but it is not that easy. At any rate
I will continue to attemp[t a conversion of this indicator as it is pretty
good.Thanks again,Rong:=0.5;L0:=((1-g)*C) +
(g*PREV);L1:=(-g*L0) + Ref(L0,-1) + (g*PREV);L2:=(-g*L1) + Ref(L1,-1) +
(g*PREV);L3:=(-g*L2) + Ref(L2,-1) + (g*PREV);cu:= If(L0>L1,
L0-L1,0) + If(L1>L2, L1-L2,0) + If(L2>L3, L2-L3,0);cd:= If(L0<L1,
L1-L0,0) + If(L1<L2, L2-L1,0) + If(L2<L3, L3-L2,0);temp:=
If(cu+cd=0, -1,cu+cd);If(temp=-1,0,cu/temp)Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|