Aiming at the influence of DC component and high-order harmonics on harmonic current detection accuracy, an improved ip-iq harmonic detection algorithm based on second-order generalized integrator is proposed in this paper.The improved SOGI filter link is added to the structure of traditional ip-iq algorithm to effectively filter the DC component of the input signal and suppress the high-order harmonics. The improved SOGI phase-locked loop can provide stable grid voltage frequency when the grid voltage contains high-order harmonics and DC components, so that the harmonic current can be detected more accurately.The traditional ip-iq algorithm and the ip-iq algorithm based on general SOGI are compared and analyzed by simulation examples, which verifies the effectiveness and reliability of the proposed harmonic detection method when the power grid contains DC component and high-order harmonic.