Painless calculate average last 10 values

Hello guys!

Is it possible to create a painless script to calculate the average of the last 10 values in the lastprice field for calculating price changes?

Thank you!

By "last 10 values" do you mean multiple values within the same field for a single document? If so, then yes.

Hi Ryan,

Thanks for response! But not! They are separate documents. Example: Doc 1, field value = 10, Doc 2, field value 15, Doc 3, Field value = 23 ...

I'm trying to create an RSI indicator for actions financial analysis and need calculate the average last values the last documents

Do you have a solution?

Thanks!

Have you looked at using aggregations?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.