Closed jias closed 5 months ago
Hi @jias, your feature request sounds like this one https://github.com/bennycode/trading-signals/discussions/626 - Am I right with this?
If so, then please allow me some questions:
1) Would you prefer a dedicated method (like replace
) instead of using update
or do you prefer giving a state to the update
method (like update('replace')
)?
2) Do you know when you want to replace the value, so that you could either call an update
method or replace
method?
I made an API proposal here: https://github.com/bennycode/trading-signals/pull/654
I am happy to announce that this feature is now possible with v5. 🥳
Just pass true
as a second parameter to the update
function:
const rsi6 = new RSI(6);
rsi6.update(100);
rsi6.update(50, true); // replaces 100 with 50
I am making a real-time K-line chart (like Binance), so the indicator of the last bar needs to be updated when new trades happened. But in the following
rsi6
example, after calling the update() method, how to cancel the last value and recalc the current value?