PureBytes Links
Trading Reference Links
|
Thanks, Tomasz. Starting the Wilders averaging at bar one is what made
the difference. With a slight change to my loop, I now get exactly the
same as AB.
Regards,
GP
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>
> Hello,
>
> There are two reasons why formula provided below generates slightly
different values at the beginning
> a) it outputs one bar later than built-in RSI because of the Ref( C,
-1 ) used that generates response starting from bar 1 not zero.
> b) initial (start) value of built-in Wilders() function is not
calculated exponentially but rather as SIMPLE moving average (the
> same with EMA).
> This is for matching Metastock implementation that people were
asking for in the past.
>
> The averages inside built-in RSI are initialized with zero and use
recursive calculation from the very beginning (bar zero).
>
> If you want to actually DUPLICATE exactly built-in RSI from the very
first bar you need to write loop:
>
> function BuiltInRSIEquivalent( period )
> {
> P = N = 0;
>
> result = Null;
>
> for( i = 1; i < BarCount; i++ )
> {
> diff = C[ i ] - C[ i - 1 ];
> W = S = 0;
> if( diff > 0 ) W = diff;
> if( diff < 0 ) S = -diff;
>
> P = ( ( period -1 ) * P + W ) / period;
> N = ( ( period -1 ) * N + S ) / period;
>
> if( i >= period )
> result[ i ] = 100 * P / ( P + N );
> }
> return result;
> }
>
> Plot( BuiltInRSIEquivalent( 14 ), "RSI 1", colorRed );
> Plot( RSI( 14 ), "RSI 2", colorBlue );
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "gp_sydney" <gp.investment@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Friday, July 27, 2007 2:50 PM
> Subject: [amibroker] Re: RSI Calculation wrong?
>
>
> > Graham,
> >
> > That plot exactly matches what I get when I manually calculate RSI,
> > but doesn't exactly match what AB gives. It fairly quickly converges
> > to be the same as AB, but is different at the start for some reason.
> >
> > Regards,
> > GP
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@> wrote:
> >>
> >> I believe this is same as AB in AFL (plots match), although my
> > encyclopaedia
> >> uses EMA not Wilders
> >>
> >> PerRSI = 14;
> >> MUp=IIf(C>Ref(C,-1),C-Ref(C,-1),0);
> >> MDn=IIf(C<Ref(C,-1),abs(C-Ref(C,-1)),0);
> >> Rup = Wilders(Mup,PerRSI);
> >> Rdn = Wilders(Mdn,PerRSI);
> >> gkRSI = 100*(Rup / (Rdn+Rup) ) ;
> >>
> >>
> >>
> >> --
> >> Cheers
> >> Graham
> >> AB-Write >< Professional AFL Writing Service
> >> Yes, I write AFL code to your requirements
> >> http://www.aflwriting.com
> >>
> >>
> >> On 27/07/07, Chris J <systemofthewave@> wrote:
> >> >
> >> > Good evening,
> >> > I'm using Amibroker to write a system and also the C++
language. The
> >> > problem is my RSI value doesn't match up to AmiBrokers. Here is my
> > data for
> >> > a RSI of 8 periods using GBP/USD;
> >> > the values;
> >> > 1.9796
> >> > 1.9810
> >> > 1.9796
> >> > 1.9736
> >> > 1.9663
> >> > 1.9629
> >> > 1.9531
> >> > 1.9545
> >> > 1.9566
> >> > differences;
> >> > +14
> >> > -14
> >> > -60
> >> > -73
> >> > -34
> >> > -98
> >> > +14
> >> > +21
> >> > plus_average = .0049 / 8 = 0.0006125
> >> > minus_average = .0279 / 8 = .0034875
> >> > (plus_average / minus_average) + 1 = 1.1756272401
> >> > 100 / 1.1756272401 = 85.0609
> >> > 100 - 85.0609 = 14.9391 - my result
> >> > Amibroker shows 17.9051 - AmiBrokers
> >> > This is the RSIa indicator using the first RSI value and no
> > smoothed RS
> >> > since it's the first value for both my system and AmiBrokers.
> > Driving me
> >> > nuts.
> >> > Chris
> >> >
> >> > ------------------------------
> >> > Shape Yahoo! in your own image. Join our Network Research Panel
> >
today!<http://us.rd.yahoo.com/evt=48517/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7>
> >> >
> >> >
> >>
> >
> >
> >
> >
> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
>
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|