Matching bars of smaller timeframe to the bar of larger timeframe

 

I would like to write an indicator that matches bars in the 1 minute time frame to bar number 1 of the 15 minute time frame and then to draw a rectangle around those bars in the 1 min time frame. I'd appreciate if someone could give me an idea how to code that.


Here's the illustration of what I would like to do:


bars in 1 min frame

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5

|--------------------------------------| |---------|

bar number 1 (has already formed) zero bar (is still forming; only 5 min have passed)

15 min TimeFrame 15 min TimeFrame

When I have a 1 min chart open, I would like to highlight those bars that correspond to Bar number 1 of the 15 min time frame.


Hope this explanation is clear.


Any help will be appreciated.

 

on 1m chart:

Loop through the bars...

if( MathMod(iTime(Symbol, 1, i), 15*60) == 0) // found a 1 minute bar on a 15 minute boundary

 

That should work for me.


Thanks for your help!