It looks like you're new here. If you want to get involved, click one of these buttons!
BUT, If I call the function at say 9.45 AM then it has only 6 M5 candles for that day and other 14 candles should be from yesterday closing
You can check an example regarding sending the required param to fetch historical data here.