The energy, spatial and pitch angle distributions of the accelerated electrons in the solar magnetic loops are considered. Hard X-ray spectrum and polarization are calculated. It is shown that the hard X-ray source at the looptop can be formed even with the anisotropic injection away from the looptop. The polarization degree is –30% at the top of the magnetic loop. A comparative analysis of the results with different parameters of the source of accelerated electrons and magnetic field is also carried out.