For returns x1 through xn with full-sample mean m and integer lag k with 1 <= k < n, NIST defines lag-k sample autocorrelation as the sum of (xi - m) × (xi+k - m) for i=1 through n-k, divided by the sum of (xi - m)^2 for i=1 through n. This is not necessarily the same as a software function that computes Pearson correlation between two shortened vectors with separately recalculated means.
The denominator must be positive. If every observed return is the same, this estimator is undefined, not zero. Equally spaced daily account returns differ from irregularly timed executed-trade R observations.