A scenario popped up in my mind that seems legal but feels like cheating. Say a level 20 wizard used True Polymorph to become an Adult Gold Dragon, at age 800 years and 364 days old. As stated in another question, this puts him a day before he becomes an Ancient Gold Dragon. So the wizard just waits for a day, and now he is permanently an Ancient Gold Dragon. This seems to not be what the spell intended because they put the CR cap, but I can't see anything restricting it.
Ask your DM
Unfortunately, while you can True Polymorph (PHB, 283) into a new form that:
... can be any kind you choose whose challenge rating is equal to or less than the target's...
It doesn't actually state that you can pick age, etc. Nor is it clear that the age categories are exact for dragons. Nor is it clear you can pick a specific age dragon. A DM could very reasonably rule you pick Red Dragon and it uses your age to determine what age dragon you are.
Ultimately, you're just picking "Red Dragon", and that's it. But it's up to your and DM to determine if picking an Age and 'aging' into an Ancient dragon is allowable at your table.
How would this DM approach it?
I probably wouldn't allow it. It feels too much like trying to game the system and the rules aren't clear enough for me to allow it. And becoming an Adult dragon is still pretty darn cool.
You can't necessarily pick any particular age when you turn into a dragon; even 'adult red dragon' might not be a 'kind' of creature in your DM's campaign. Even if you can turn into specifically an Adult Red Dragon instead of just choosing Red Dragon, you don't necessarily have any control over the exact age of that dragon when you turn into it.
Regardless, unless your DM rules that 'Red Dragon' isn't a kind of creature, which would definitely be a big stretch, you can certainly turn into some age of Red Dragon and wait (or force-age yourself) to be ancient.
Even so, though, note that you will never actually be an ancient dragon. Ancient dragons have legendary actions and the rules say:
If a creature assumes the form of a legendary creature, such as through a spell, it doesn’t gain that form’s legendary actions, lair actions, or regional effects.
So you will never get those off a Legendary Dragon by assuming its form as a character that is a creature.
Furthermore, even a permanent True Polymorph can be dispelled. Unless you are an elf or a druid or both, you may well then immediately die of old age.