We propose a valid scheme to measure the Hubble parameter $H(z)$ at high redshifts by detecting the Sandage-Loeb signal (SL signal) which can be realized by the next generation extremely large telescope. It will largely extend the current observational Hubble parameter data (OHD) towards the redshift region of $z in [2.0,5.0]$, the so-called redshift desert, where other dark energy probes are hard to provide useful information of the cosmic expansion. Quantifying the ability of this future measurement by simulating observational data for a CODEX (COsmic Dynamics and EXo-earth experiment)-like survey and constraining various cosmological models, we find that the SL signal scheme brings the redshift upper-limit of OHD from $z_mathrm{max}=2.3$ to $z_mathrm{max}simeq 5.0$, provides more accurate constraints on different dark energy models, and greatly changes the degeneracy direction of the parameters. For the $Lambda$CDM case, the accuracy of $Omega_m$ is improved by $58%$ and the degeneracy between $Omega_m$ and $Omega_ {Lambda}$ is rotated to the vertical direction of $Omega_k = 0$ line strongly; for the $w$CDM case, the accuracy of $w$ is improved by $15%$. The Fisher matrix forecast on different time-dependent $w(z)$ is also performed.