This paper proposes a new control technique for Unified Power Quality Conditioner (UPQC) control system, which can generate voltage and current reference components quickly and without sensitivity to the power frequency variation. Therefore, the stability of the compensation procedure will be improved greatly. The proposed technique uses wavelet transform decomposition and Multi-Resolution Analysis to extract the fundamental component of distorted waveform and The Least Square error method for estimating frequency, amplitude and phase angle of the fundamental component. In this case, Least Square method is used for estimating the amplitude and phase angle of a sine waveform, so the proposed control technique can extract compensating components quickly and accurately. Analyzing the proposed technique for series and shunt active power filter control, as well as simulation results are presented. Results confirm that the proposed method can extract voltage and current references not only more accurately and faster than other well-known control techniques, but also without sensitivity to the frequency variation.