How to program varying time intervals?

 

I have basic skills in programming. Basically when I trade manually by visual interpretation I will scan multiple bars (varying time intervals) on the same time frame (e.g. 15min) for patterns in price (e.g. High/Low). However the number of bars scanned are never fixed.

So my question is what is the best way to get MQL4 to constantly search different time intervals for the recognition pattern?

Thanks in advance.

Reason: