Had not looked at the 10+ page pdf, but from what you provided in your Prime sheet I guess what you meant was simply a sliding window with width RS.
No need for a worksheet range "i" and no need to index the vector "IAS" when you define or display it.

BTW, using inline evaluations can sometimes end in unexpected errors and troubles - so its better to avoid them. I am talking about the evaluation "=" immediately after the definition of a variable. You are on the safe side if you define a variable in one region "var:=..." and evaluate it in second one "var=...".