Currently, I have history data for 10 years.
Most of the time, I only interested in getting EMA/ MACD for the last history point (means yesterday point). Instead of using entire 10 years history, I would only like to provide N data points, for fast calculation, yet get a reasonable accurate EMA. Currently, here is the way for me to determine how many N data.
9 days SMA lookback = 8
9 days EMA lookback = 8
9 days 12/26 MACD lookback = 33
final int scale = 2;
startIndex = historyDataSize - ((lookback + 1) * scale);
for (int i = startIndex; i < historyDataSize; i++) {
// ...
}
I know I can further increase scale to get a reasonable good EMA/ MACD outcome. The question is, how large I should increase, for fast calculation purpose, yet reasonable accurate?