Preference of locants in organic nomenclature
As pointed out by Loong, the name you prefer is the correct name: 4-ethyl-5-methyloctane.

Generally we try to do the following:


Assign the smallest locant possible to the carbon bearing the highest priority functional gorup.
Assign locants to generate the lowest possible sum of the locants.


Often it is straightforward. In this case, both assignments of generate locants of 4 and 5, which sum to 9. Both place an alkyl substituent at the lower locant.

In this case, the locants are assigned so that the alphabetically first of the two substituents of equivalent priorty receives the smallest locant. 


  Correct - 4-ethyl-5-methyloxctane: ethyl is alphabetically before methyl and should get a smaller locant
  
  
  Incorrent - 5-ethyl-4-methyloctane: ethyl is alphabetically before methyl and should get a smaller locant