@that_adam_guy You got the general idea. However, you will need different variables for each timefram. They cannot be stored as you suggest. Additionally I guess you are searching for lows and highs with a limited period of time. You also need to specify that period in candles like this:
0_1618312966845_01.png
This is the way to store the highest price on H1 timeframe for the last 10 candles.