Freddy:

It sounds like your problem is more related to drifts & obstructions, rather than a magic formula of line length versus leader length. As you have already discovered, the more fly line you have past your tip top, the longer leader you can cast which is due to the mass of the line among other factors. However, regardless of line, leader or tippet length; obstructions, presentation and drifts can be a problem. Here's what works for me:
  • First, see if you can present a fly properly at a given distance on open water. If you can but the low limbs give you problems, work on things like side arm or other ''trick" casts that help you avoid obstructions.
  • Some folks don't put the same amount of energy or shorten their stroke on casts when they see a potential snag staring them in the face. They compromise what they would normally do on open water to compensate for the obstruction. One solution that often works for me is to make sure you can make the cast in the first place by trying a few presentations at the same distance using the same casting technique, AWAY from the snags. After you feel confident, make your presentation to the area with the low limbs.
  • Sometimes the ONLY answer to obstructions is to sneak up as close as you can and make a short presentation. BTW-in those cases a shorter leader will help since your cast is shorter. I use leaders as short as 5 feet on really tight streams and have no problems catching fish.
  • If you are having trouble getting the leader to STRAIGHTEN out at a given distance, the first thing I would look at is the size and length of your tippet. I don't subscribe to magic formulas but I find that 3-4X works with just about any fly size except the biggest and the smallest. Many folks use too light a tippet for the fly they are throwing. While I use a lot of 7X-8X where I fish, I'm not using it with #14 beadhead nymphs or size 12 hoppers.
  • If you are using 3X or 4x and you still have a problem, possibly your tippet is too long. Again no magic formulas but I can usually get away with a 24" tippet with any size fly although I normally like one about 36".
  • If your tippet isn't too light or too long, possibly your overall leader is too long. Even though I routinely use leaders as long as 18 feet, it's more about me forgetting to cut away excess tippet material than a need for a super long leader. I really think that 7-9 feet cuts it in all but the tightest quarters so use that as a starting point. Coincidentally, when ever I have leader straightening issues it's usually because I've allowed my leader to get too long.
  • If your biggest problem ISN'T with obstructions but drift, that's a whole other problem. The simplest thing to try if possible is to just move slightly and make subtle adjustments to the cast to try and get a different drift. I have cast to a particular fish 20-30 times moving a few inches at a time and making subtle adjustments until I get a good enough drift to induce a strike. If you move slowly and cautiously, the fish will hardly notice. Sometimes after you move it's just about waiting a bit until the fish calm down.
These are the cures that work for me and are simplest to check and adjust. I wish it was as simple as I am trying to make it sound, but unfortunately there are other things that can give you leader headaches like casting issues. If all else fails, give your rig with the problematic leader, fly and tippet to a friend and see how they fare. If the problems persists it may be the tackle; if the problems go away it might be your casting which I'll leave to the experts.

Have fun figuring it out!