RSI calculation

Created at 23 Sep 2018, 09:24
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
lec0456's avatar

lec0456

Joined 14.11.2012

RSI calculation
23 Sep 2018, 09:24


I am trying to verify the RSI indicator calculations and I am having trouble.

 

What is the code behind the RSI calculation in cTrader?

 

At some point it was posted but I can no longer find it.  I beleive it is using an EMA and I do not understand why.

To my understanding the RSI is supposed to be calculated using the SMA of the profit and loss.

Can you please let me know.

 


@lec0456
Replies

lec0456
23 Sep 2018, 09:46

Also, even if it is correct to use the ema.  Why does the formula calculate the ema periodsd as:

var emaPeriods = 2 * paramPeriods - 1;

this would mean that instead of using 14 period ema it uses a 27 period ema to calculate a 14 period RSI

 

please verfiy and explain

 


@lec0456

PanagiotisCharalampous
25 Sep 2018, 16:01

Hi lec0456,

I don't know which code are you talking about but indeed this is how it is calculated. We will investigate why this is the case and come back to you.

Best Regards,

Panagiotis


@PanagiotisCharalampous

lec0456
25 Sep 2018, 23:21

There used to be sample code for all major indicators in the samples section of the forum. RSI, Stocastic, bollinger bands, EMA, SMA, etc. It was very helpful to learn and tweak indicators.


@lec0456