I’d like to say Town Hall 9 and 10 are the best levels for farming Dark Elixir in Clash of Clans not only because of more Army Camp housing spaces, extra new Spell slot, high level troops, better defensive buildings but also higher level Dark Elixir Drills and the most important part is the Archer Queen.
All those conditions help you farm Dark Elixir much easier than other Town Halls below.
When I should upgrade to Town Hall 9?
It depends on how you play Clash of Clans.
If you are a hard farmer and you can upgrade couples of Skull Walls everyday and finish those Walls before defensive buildings, just hit the Upgrade button once you have no wall to upgrade.
If you are a normal player who just can have ~1 hour to play everyday, you should wait until max all your defensive buildings before hitting the upgrade button. If you upgrade your TH quite soon, the loot penalty system will make you sick. Actually, If you are a casual farmer, you shouldn’t upgrade all your walls to level 8 at TH8, Purple Walls are absolutely ok. Don’t worry about your Barbarian King, farming Dark Elixir is much easier at Town Hall 9, he will be fine!
Once you are at TH9, you need to find a place for working on and at a time, I strongly recommend you go to Master leagues and you will swim in resources with the perfect loot bonus. You will also need to control your Heroes upgrade order for the best effective at both defensing and farming.Above are some advices from me for farming DE. If you have any suggestions, feel free to comment and we will discuss about it together!