I have these data
Open High Low Close
1 6709.0 6709.5 6703.5 6705.0
2 6705.0 6710.5 6705.0 6710.0
3 6710.5 6713.5 6710.5 6713.5
4 6713.5 6713.5 6711.5 6712.0
5 6712.5 6715.0 6712.5 6714.0
6 6714.0 6716.0 6713.5 6716.0
which are OHLC
prices of 1
minute bars. I want to find OHLC
of 5 minute bars.
Open
and Close
are easy, but I don't know how to do High
and Low
.
I need to find the maximum/minimum
values in a subset of the data.
So first I need to find max(data[1:5,2])
then max(data[6:10,2])
and so on. And I need to put the values in a vector called High
. And for Low
prices min(data[1:5,3])
.
I need something like a for loop
with two variables.