ta-rs icon indicating copy to clipboard operation
ta-rs copied to clipboard

Would it be possible to limit the number of input values?

Open AlgoQ opened this issue 2 years ago • 1 comments

Hi,

Would it be possible to limit the number of input values? Instead of adding the value to the next iterator, would it be possible to only use for example 201 input values to calculate the Exponential Moving Average? This is because if you enter for example 500 input values into an ema with a period of 200 you get a totally different output as when you enter 201 input values.

AlgoQ avatar Oct 07 '21 15:10 AlgoQ

@AlgoQ Hi, can you explain with examples? What prevents you from feeding 201 values instead of 500?

greyblake avatar Oct 09 '21 11:10 greyblake

Closing it for now, the change is not gonna be implemented anytime soon, cause I doubt that it's the design I'd like to have.

If you really need something like this, you can easily implement a wrapper around EMA that takes care of counting input items and returns Option<f64> instead f64.

greyblake avatar Oct 21 '22 18:10 greyblake