Hi rohit,
It seems your code is based on the original "Interactive Financial Chart" sample code.
In the original sample code, it already includes code that switches to weekly data if there are too many days. It also explains (in the comments) that if you do not have weekly data, you can convert from daily data to weekly data. It includes an example function that converts daily to weekly data.
It seems you have not copied that part of the code. Please review the sample code and use the part of the code that meets your needs, and modify them as necessary.
Hope this can help.
Regards
Peter Kwan |