and then calculates price for passed values, or calculates next generator value
BUT I save calculated values into DB, and there is already calculated values for indicators
So, providing already calculated values from DB may greatly increase performance for calculation.
For now, it's required to calculate values for every indicator from scratch (e.g. on app startup), even if there is values retrieved from DB
e.g.
// startup code
const pastSMAValues = await mySMADBValues.select(); // [0, 0, 0, 1, 1.1, 1.2, 1.1]
const mySMA = new SMA({ pastValues: pastSMAValues });
// runtime code
// new tick retrieved from stream api
cont newTick = { /* OHLC tick */ };
mySMA.nextValue(newTick); // 1.15 -> new SMA value for new tick based on passed pre-calculated SMA values
As I see, SMA (for example) starts with zero values
https://github.com/anandanand84/technicalindicators/blob/7740f17cf681a2b1ace3009f5f396c14cbadf1f1/lib/moving_averages/SMA.js#L24
https://github.com/anandanand84/technicalindicators/blob/7740f17cf681a2b1ace3009f5f396c14cbadf1f1/lib/moving_averages/SMA.js#L21
https://github.com/anandanand84/technicalindicators/blob/7740f17cf681a2b1ace3009f5f396c14cbadf1f1/lib/moving_averages/SMA.js#L41
and then calculates price for passed values, or calculates next generator value
BUT I save calculated values into DB, and there is already calculated values for indicators
So, providing already calculated values from DB may greatly increase performance for calculation.
For now, it's required to calculate values for every indicator from scratch (e.g. on app startup), even if there is values retrieved from DB
e.g.