Go Back   DailyFX Forum

Thread: RSI 14
View Single Post
  #4 (permalink)  
Old 07-26-2009, 11:46 PM
FrAnton's Avatar
FrAnton FrAnton is offline
Member
 
Join Date: Jul 2009
Posts: 199
FrAnton is an unknown quantity at this point
Quote:
Originally Posted by Nikolay.Gekht View Post
RSI is implemented according Perry Kaufman "Trading System and Methods" chapter 6 "Momentum and Oscillators".

The pseudo code:
Code:
sumup := 0
sumdown : = 0
for i = 1 to n begin
    if close[i + 1] - close[i] > 0 then
        sumup := sumup + close[i + 1] - close[i];
        else sumdown := sumdown + close[i] - close[i + 1];
    end;
end;
RSI = 100 - (100 / (1 + sumup / sumdown));
thank you for the sample. I guess this is just for the first period.
For the next periods it seems that it calculates Avg as:

diff = source[period] - source[period - 1];
if (diff > 0) then
sump = diff;
else
sumn = -diff;
end
positive = (pos[period - 1] * (n - 1) + sump) / n;
negative = (neg[period - 1] * (n - 1) + sumn) / n;

This is what I found in RSI body. Is that right?
Reply With Quote
 


Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.

All times are GMT -5. The time now is 10:20 PM.
Copyright ©2009 Daily FX. All Rights Reserved.