Skip to content
All library documents

Why TTR and Bloomberg Calculate RSI Differently

Article Quant Q&A · Author: Datageek

Summary

This note explains why the Relative Strength Index produced by R’s TTR package may differ from Bloomberg’s. It contrasts a rolling simple average of gains and losses over the selected period with a recursively updated average: after the initial period, the prior average is weighted by the period length minus one, then the latest gain or loss is incorporated. These methods can produce different RSI values from the same price history.

The author suggests replacing the simple moving average with a custom moving-average function and asks whether TTR already provides one. The note does not identify a specific function, give implementation details, or compare calculated values on sample data. It is therefore useful for recognizing a source of indicator discrepancies, but it does not establish the precise Bloomberg convention for every setting or provide a complete solution.

Key ideas

  • RSI values can differ across platforms because their gain and loss averages use different smoothing methods.
  • TTR is described as using a rolling simple average in this example.
  • Bloomberg is described as recursively updating the averages after the initial period.
  • Matching platform calculations may require using the same averaging convention.

Tags

Full text
# R TTR/RSI does not behave like a Bloomberg RSI


# R TTR/RSI does not behave like a Bloomberg RSI












The implementation of TTR:RSI differs slightly from the RSI calculated in Bloomberg, see more details here.

I use in TTR the SMA, which simply calculates the mean, that is a walking window of:

> Sum of gains and losses over the 14 days (assuming it's the 14 days period)

In Bloomberg this is done only for first 14 days, subsequent days are calculated as:

> [(previous average gain) x 13 + last gain] / 14

I suspect it should be enough to swap SMA with a custom moving average function. Was just wondering if such a function is already a part of TTR or is easy to implement?

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.