Hi everyone,
Could someone please provide me with the code of calulating RSI(relative strength index) in C#, i'm having difficulties in trying to achieve this;
The following are the steps to calculate RSI;
1. Calculate the advances and declines of the closing price (differences between Current day closing price and previous day closing price).
If Current Day Closing Price is greater than Previous Day Closing Price then
Advance = Current Day closing price - Previous Day closing price
If Current Day Closing Price is Less than Previous Day Closing Price then
Decline = Previous Day closing price - Current Day closing price
2. Calculate the Average gains and losses (14 periods)
Average gain = Total Gain for the past 14 days / 14
Average Loss = Total Loss for the past 14 days / 14
3. Relative Strength (RS)
Relative Strength = Average Gain / Average Loss
4. RSI RSI
RSI = 100 - (100 / (1 + RS))
Any help would be greatly appreciated.
Thankyou,
Jonny.
Could someone please provide me with the code of calulating RSI(relative strength index) in C#, i'm having difficulties in trying to achieve this;
The following are the steps to calculate RSI;
1. Calculate the advances and declines of the closing price (differences between Current day closing price and previous day closing price).
If Current Day Closing Price is greater than Previous Day Closing Price then
Advance = Current Day closing price - Previous Day closing price
If Current Day Closing Price is Less than Previous Day Closing Price then
Decline = Previous Day closing price - Current Day closing price
2. Calculate the Average gains and losses (14 periods)
Average gain = Total Gain for the past 14 days / 14
Average Loss = Total Loss for the past 14 days / 14
3. Relative Strength (RS)
Relative Strength = Average Gain / Average Loss
4. RSI RSI
RSI = 100 - (100 / (1 + RS))
Any help would be greatly appreciated.
Thankyou,
Jonny.