Discrete Fourier transform(DFT) is popular in harmonic analysis of power systems. The statistical characteristics of DFT algorithms for synchronous sampling and asynchronous sampling under stochastic condition are studied. DFT algorithms contain normal DFT algorithm and windowing DFT algorithm. The statistical characteristics contain the mean value, the variance and the correlation for every order of harmonic and so on. A non-deviation estimation approach for harmonic amplitudes and phase angles with windowing DFT algorithm is deduced. A novel time-invariant windowing DFT algorithm is proposed based on the condition deduced. Simulation results based on MATLAB show the correctness of the conclusions given.