In order to implement real-time detection of harmonic currents with the system voltage distortion and frequency shift,a method for any harmonic current detection based on the instantaneous reactive power theory is presented.This method can get the grids real-time frequency information when the grid contains harmonics or negative sequence currents. The theoretical analysis and simulation results show that the algorithm can improve detection precision effectively,and the detection performances are not affected by the frequency shift and distorted voltage.