Hi,

I am trying to write an algorithm that does the following:

Calculate the Stochastic Ks of some (29 in this case) symbols based on 5 minute bars.

Sort the symbols by this Stochastic K.

If a symbol was in the top-5 3 calculations ago (based on Stochastic K), but during the last 2 calculations it is out of the top 5, then emit a Down insight.

When I didn't include the "minutes%5==0" part, my Rolling Windows got updated every minute, despite me only wanting them to update every 5 minutes.

Is my code doing what I want and is there a way to do this more elegantly inside an Alpha Stream? (I found some Consolidation methods but they were all inside an Algorithm, not an AlphaStream and I couldn't make them work in my AlphaStream.)