Question:
How come there is difference in calculated RSI, between my system and bank, even if using the same settings ? The source data (OHLC) is the same for both systems. I have intentionally left out "maType" since the default is "MA".
Observations so far:
Reading this link: https://quant.stackexchange.com/questions/30134/r-rsi-calculation-ttr-package
it seem that the standard TTR RSI uses the Wilder EMA. I assume this could be a reason why the RSI result are being different.
Current state of troubleshooting:
Made some tests of adding wilder = FALSE which gives RSI values close to the banks values, but not exact. I also notice that the RSI result differs whether you add emaType or leave it out, which seems to be a bug since leaving it out should use emaType="EMA".
The scenario:
Using R R6 to create object-oriented classes and TTR to create the RSI indicator result:
create_indicator_result_data = function() {
self$rsi_result_column <- round(
RSI(
price = decisions$mktdata_decision_map$Close,
n = 14
), digits = 2
)
},
The result in proprietary system (using "ask price").
OHLC data (downloaded from banks API) + "RSI result":
Date / Time / Open / High / Low / Close / RSI_result
2019-07-16 13:12:00 1623.37 1623.50 1623.25 1623.50
2019-07-16 13:14:00 1623.37 1623.75 1623.37 1623.75
2019-07-16 13:15:00 1623.62 1623.75 1623.50 1623.50
2019-07-16 13:16:00 1623.62 1623.75 1623.50 1623.75
2019-07-16 13:17:00 1623.87 1624.00 1623.50 1623.50
2019-07-16 13:18:00 1623.62 1623.75 1623.50 1623.75
2019-07-16 13:19:00 1623.62 1623.75 1623.50 1623.75
2019-07-16 13:20:00 1624.00 1624.25 1624.00 1624.25
2019-07-16 13:21:00 1624.12 1624.25 1624.00 1624.00
2019-07-16 13:22:00 1624.12 1624.50 1624.12 1624.50
2019-07-16 13:23:00 1624.75 1625.00 1624.75 1624.75
2019-07-16 13:24:00 1624.87 1625.00 1624.75 1624.75
2019-07-16 13:25:00 1625.00 1625.25 1625.00 1625.00
2019-07-16 13:26:00 1625.12 1625.75 1625.00 1625.50
2019-07-16 13:27:00 1625.62 1625.75 1625.50 1625.50 78.57
2019-07-16 13:28:00 1625.62 1625.75 1625.62 1625.75 80.10
2019-07-16 13:29:00 1625.50 1627.00 1625.50 1626.75 84.78
2019-07-16 13:30:00 1627.25 1627.75 1626.75 1627.75 87.86
2019-07-16 13:31:00 1627.87 1628.75 1627.50 1628.37 89.30
2019-07-16 13:31:00 1627.87 1628.75 1627.50 1628.25 87.14
Result on the bank graphics: bank uses also period = 14 and "ask-price".
Date / Time / RSI result
2019-07-16 13:27:00 73.96
2019-07-16 13:28:00 76.01
2019-07-16 13:29:00 82.09
2019-07-16 13:30:00 85.93
2019-07-16 13:31:00 86.30