How to compute standard deviation for nearest 20 negative returns?

I want to compute standard deviation only for nearest 20 negative returns.
I don't mean to compute for these 20days return that exclude positive number.
I mean nearest 20 negative numbers that to be include in the compution of standard deviation.
Please help me .

You need to use SparseCompress/SpareExpand before you call StdDev if you want to operate on selected bars only.

https://www.amibroker.com/f?sparsecompress

3 Likes

Hi, @Tomasz

thanks for help. :slightly_smiling_face:

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