How can I get the candle data of another time frame

 
for instance, I have a Robot which is trading on the 5Min chart but I will also collect and use the data of the last 1Min, 15Min, 30 Min or any other candle. How can I retrieve these data.
Reason: