Weekly & monthly script code

I am not able to write a script in scanner for Weekly and Monthly “Open, Close, High, Low” etc. in Zerodha Pi.
Please guide.