AFL code - trading logic based on CCI value

I struggle to write code describing following condition: Buy on close when CCI(10) is crossing 0 to positive area WHILE CCI(21) is at least 3 bars above 100.

Code for condition for CCI (21) is not clear to me - how to code that CCI has to stay above 100 level for all 3 bars. I don´t want to count bars since CCI(21) crossed level 100.

Thanks a lot,


REF(CCI(21),-3) > 100 AND
REF(CCI(21),-2) > 100 AND
REF(CC1(21),-1) > 100 AND
CROSS(CCI(10) , 0)