To learn how to use multiple time frames in your code, you should search this forum for the word MTF. You’ll be returned many articles, posts and code snippets to learn from.
This is your code as requested (not tested):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Timeframe(5minute,UpdateOnClose)//or Timeframe(5 minute,default) not to wait the 5-minute closing
Y1=high
X1=low
//
Tomeframe(1minute,UpdateOnClose)//or Timeframe(1 minute,default) not to wait the 1-minute closing
c1=close>close[1]
c2=close<close[1]
//
Timeframe(default)//this the TF on your chart, it cannot be higher than the lowest TF used in your code (1 minute in your case)