For a weakly stationary time series $\left\{r_{t}\right\}$, the definition of ACF is (from Ruey Tsay's "Analysis of Financial Time Series") $$ \rho_l=\frac{Cov(r_t,r_{t-l})}{\sqrt{Var(r_t)Var(r_{t-l})}}=\frac{Cov(r_t,r_{t-l})}{Var(r_t)} $$
And then in the book, for a given sample of returns $\left\{r_{t}\right\}^T_{t=1}$, then $$ \bar{r}\equiv\frac{1}{N}\sum^T_{t=1}r_t\\ \hat{\rho_l}=\frac{\sum^T_{t=l}(r_t-\bar{r})(r_{t-l}-\bar{r})}{\sum^T_{t=l}(r_t-\bar{r})^2} $$
But I think we should have a factor of $\frac{T-l-1}{T-1}$ modification on $\hat{\rho_l}$, that is $$ \hat{\rho_l}=\frac{T-l-1}{T-1}\frac{\sum^T_{t=l+1}(r_t-\bar{r})(r_{t-l}-\bar{r})}{\sum^T_{t=l}(r_t-\bar{r})^2} $$
The reason is from the definition of $\rho_l$,
$$ Var(r_t)=\frac{1}{T-1}\sum^T_{t=1}(r_t-\bar{r})^2\\ Cov(r_t,r_{t-l})=E[(r_t-\bar{r})(r_{t-l}-\bar{r})]=\frac{1}{T-l-1}\sum^T_{t=l+1}(r_t-\bar{r})(r_{t-l}-\bar{r}) $$
Notice here I used $(T-1)$ and $(T-l-1)$ to make the variance estimator unbiased.
Using the textbook formula seems not to be reasonable, especially when $l$ is close to order of $T$, the formula will strongly underestimate the autocorrelation because of a huge truncation of the used data length. Can anyone tell me where I am wrong?