I'm looking for a reference algorithm for calculating historical volatility to price options. I know there are several volatility calculation models that use the time series of the underlying's returns. Is there a reference method for determining the number of days to consider for the calculation?
You should review the difference between implied volatility and realised volatility. Historical volatility is the realised volatility that happen in the past but an option price will have to be determined by the view of the market about volatility in the future for a given period. Normally you do the inverse, ie the option price is given by the market but you can work out the implied volatility from that price.