Correct. As described in Jarulf's Guide, section 2.6 Experience points, your experience is decreased if your level is greater than the level of the monster. You lose 10% of the expected experience for each level greater, and get 0% experience if your level is 10 or more higher than the monster.
There is no such class as Ranger in the original game. As a level 24, you will need to fight enemies of level 15 or higher to get experience. Jarulf's Guide does not group the monster data in a way to quickly answer this question, but based on scanning through the monster group types, I estimate you will start to gain experience no earlier than dungeon level 8, the last level of the Catacombs. Starting on level 8, you can encounter Toad Demons, a level 16 enemy. Level 8 also allows Mud Runners (level 15), and Poison Spitters (level 15), as well as some enemies that are of too low a level to give you experience (Mud Man, Gargoyle, Magma Demon, Blood Stone, Horned Demon, Acid Beast). As you get deeper, the enemy levels will generally continue to rise. You can encounter full experience (monster level 24 or higher) enemies starting on floor 12, the bottom of the Caves.