coin-unknown / Indicators

Technical indicators for cryptocurrencies, stocks and forex. To work with historical and real price data. One of the most efficient Javascript library implementations. The library has such indicators as: Relative Strength Index (RSI), Moving Average C / D (MACD), Average Directional Index (ADX), Stochastic Oscillator, Bollinger Bands, Average True Range (ATR) and many others
377 stars 54 forks source link

momentValue undefined on period-matching count #38

Open cluxig opened 1 year ago

cluxig commented 1 year ago

Create SMA(10) and add 9 numbers, using nextValue(). Now the 10th value is added via momentValue(). Currently, this leads to undefined, which is also proven by code review.

The 10th added momentValue() must result in a "momentally" of the 10th next-value pendant. Only after the SMA (and other indicators) are lifted over their undefined states, incoming moment-values are suitable.