how to use multiple shift in n indicator?

 

Hi, I an still learning ho to write code properly.

What I was oping is for someone to help with an iCustom feature where given a set of circumstances I want the indicator to look back upto 5 candles.

For example, assume I do an icustom for a particular indicator call test to trigger when it gives an arrow BUT only if another indicator test2 also gave a signal upto 5 candles back.

I can do this the long way and write the code for each situation and have a shift of 0 for indicator test2, and then do it again with a shift of 1 for test2, and then shift 3 etc etc.

Is there a quicker way for me to do this where I can tell the iCustome formula to look back a shft of upto 5 candles.

I hope this makes sense.

Thanks

 
Show your code.