Unequal ROC indicator output in compare to Binance real time data
Wh1rlw1nd opened this issue · 1 comments
I see there is already some questions about this, and probably its me who doesn't use this library correctly.
But, here is what is found in docs:
var ROC = require('technicalindicators').ROC
var data = [11045.27,11167.32,11008.61,11151.83,10926.77,10868.12,10520.32,10380.43,10785.14,10748.26,10896.91,10782.95,10620.16,10625.83,10510.95,10444.37,10068.01,10193.39,10066.57,10043.75];
var period = 12;
var expectResult = [-3.85,-4.85,-4.52,-6.34,-7.86,-6.21,-4.31,-3.24];
What I tried is this:
let inputData = {
values: data, // 100(or even 200 and 500) candlesticks, 1h candlestick data, values[0] is oldest closing price
period: 30,
};
const results_rsi = RSI.calculate(inputData);
const results_roc = ROC.calculate(inputData);
But this way gives me quite accurate RSI value, and when same applied to ROC, a very inaccurate value.
When I say value, I mean that I get last element from results_rsi and results_roc array.
This is how I fetch data trough Binance API
Am I doing something wrong? What is actual result (which element of results array)?
Also I never found in docs, in which order elements (closing prices in this case) should be ordered? (asc or desc)?
I have raised a question on StackOverflow with a bit more info.
Ugh, this should be closed. I was comparing the result from the latest candlestick that just started, rather than the one that is lastly completed. Results are actually quite precise, same as on Binance.