PureBytes Links
Trading Reference Links
|
Thanks
Dale,
<FONT face=Arial color=#0000ff
size=2>
Ara
pointed out privately that my first solution was incorrect. Following Tomasz's
example in 11896 ...
<FONT face=Arial color=#0000ff
size=2>
MS example
(close*0.18)+(PREV*0.82)can be written in AFL as:result = AMA2(
close, 0.18, 0.82 );orresult = AMA( close, 0.18
);
<FONT
face="Courier New">
could
we perhaps use AMA2 (which I always struggle with) to arrive at something
like?........
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial
color=#0000ff>
g=<FONT face=Arial
color=#0000ff size=2>0.5<FONT face=Arial
color=#0000ff>;
L0=<FONT
color=#0000ff>AMA2(<FONT
size=2>1-g*<FONT
size=2>C<FONT
size=2>,1<FONT color=#282828
size=2>,g);
L1=-<FONT
color=#0000ff>AMA2(g*L0 +<FONT
size=2>Ref( L0,-1<FONT
size=2>),1<FONT color=#282828
size=2>,g);
L2=-<FONT
color=#0000ff>AMA2(g*L1 +<FONT
size=2>Ref( L1,-1)
,1<FONT
face=Arial color=#0000ff>, g);
L3=-<FONT
color=#0000ff>AMA2(g*L2 +<FONT
size=2>Ref( L2,-1<FONT
size=2>),1<FONT color=#282828
size=2>,g);
<FONT face=Arial
color=#0000ff>
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><FONT face=Arial
color=#0000ff>,cu/temp);<FONT
color=#0000ff>
<FONT face=Arial
color=#0000ff size=2><FONT
face=Arial color=#0000ff><FONT
color=#282828>
<FONT
color=#0000ff>Plot(x,"",4);
<FONT face=Arial color=#0000ff
size=2>graphxspace=10;
<FONT face=Arial color=#0000ff
size=2>
Regards,
Jayson
<FONT face=Tahoma
size=2>-----Original Message-----From: msc626
[mailto:msc626@xxxxxxxxx]Sent: Tuesday, December 09, 2003 1:08
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re:
Laguerre RSI IndicatorAlso, check out messages #11896,
12560 & 28399.dale b--- In amibroker@xxxxxxxxxxxxxxx, "rck1135"
<rkrebs@xxxx> wrote:> Thanks 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)+PREV> the 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,> Ron> > > > g:=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.
|