The ip-iq harmonic detection method based on instantaneous reactive power has been widely used in active power filter (APF). However, the traditional ip-iq detection method has errors when the grid voltage is unbalanced and distorted. This paper proposes an improved ip-iq harmonic detection method, which uses adaptive notch filter (ANF) to extract the fundamental positive-sequence voltage signal, so that the phase locked loop (PLL) can still accurately obtain the phase information under bad grid conditions. At the same time, moving average filter (MAF) is used to replace low-pass filtering to reduce the detection delay. The simulation results show that the improved ip-iq detection method can accurately detect harmonic current under non-idea...