Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Incorrect RSI results
 Post subject: Incorrect RSI results Post rating: 0   New post Posted: Fri 03 Jul, 2015, 08:19 
User avatar

User rating: 0
Joined: Mon 16 Jun, 2014, 06:30
Posts: 18
Location: Latvia,
Hello.
Im just wondering why my calculated indicator results is different from Indicator on histogram value with the same settings in strategy backtesting.
My code for RSI indicator calculation:
   private double GetRSIvalue(int shift, int period) throws JFException{
       double rsi =0;
       rsi=indicators.rsi(gSymbol, gPeriod, OfferSide.BID, AppliedPrice.WEIGHTED_CLOSE, period,shift);   
       return rsi;                       
   }


with this code I get for specific time different results comparing with on chart indicator.
Help me please find where is the problem.

Thank You


 
 Post subject: Re: Incorrect RSI results Post rating: 0   New post Posted: Mon 06 Jul, 2015, 10:59 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Wiki.

Probably you use different filter on the chart and in the source...


 
 Post subject: Re: Incorrect RSI results Post rating: 0   New post Posted: Mon 06 Jul, 2015, 11:02 
User avatar

User rating: 0
Joined: Mon 16 Jun, 2014, 06:30
Posts: 18
Location: Latvia,
Hi. No, filters are the same!


 
 Post subject: Re: Incorrect RSI results Post rating: 0   New post Posted: Mon 06 Jul, 2015, 15:56 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Precise indicator result depend on when the indicator calculation is started. Chart calculates the values on a large period but strategy uses only lookback. This causes indicator output values to differ. This does not mean that relative indicator values are bad. Both indicator outputs will usually produce same signals.

To bring strategy values closer to chart outputs indicator needs to be called with more values (e.g. 200). To do that the strategy can call this function:
https://www.dukascopy.com/client/javadoc/com/dukascopy/api/IIndicators.html#rsi(com.dukascopy.api.Instrument,%20com.dukascopy.api.Period,%20com.dukascopy.api.OfferSide,%20com.dukascopy.api.IIndicators.AppliedPrice,%20int,%20com.dukascopy.api.Filter,%20int,%20long,%20int)


 
 Post subject: Re: Incorrect RSI results Post rating: 0   New post Posted: Mon 06 Jul, 2015, 16:54 
User avatar

User rating: 0
Joined: Mon 16 Jun, 2014, 06:30
Posts: 18
Location: Latvia,
Thanx!


 

Jump to:  

cron
  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com