Firstly, you need to read up on the mech and ensure it can handle the gearing you are asking of it. Subtract the number of teeth on your small chainring from the number of teeth on your large chainring. Then subtract the number of teeth on your smallest cassette cog from your biggest cassette cog. Add both of these together and the figure will determine the capacity required to run a rear mech successfully. Your X7 mech looks to be a long cage, but was originally setup to run (48-34=)14 + (36-11=)25 = 39 teeth. You are now asking it to handle (50-34=) 16 + (36-11=) =42 teeth. That should still be within limits.
That leaves the chain length. All the formulae in the world will not beat direct measurement. Take a new chain and wrap it around the biggest chainring and the biggest cog, bypassing the mech. Note where the exact length touches . Then add two full links. One link is one side plate and one recessed link. . Then cut the chain with those two extra full links in place.
Without the chain on, shift the rear mech to the smallest cog and check visually that the top jockey wheel lines up with the smallest cog on the cassette. Now shift up as far as the shifter will allow and check that the jockey wheel lines up visually with the 36t cog. If it doesn't, adjust using the limit screw. You may have to adjust cable tension at this point. Check also that the top of the jockey wheel is about 8mm away from the bottom of the 36t sprocket. If it isn't, adjust this gap using the end limit or B tension screw
Thread the chain and join it with a power link. The power link should be counted as one side plate link, or a half link. Shift your gears to small small. Note the shape of the rear mech. It will be folded back on itself but still have some tension, albeit only a tiny amount. If the chain is slack and the chain fouling itself at the back of the mech, this is an early indication that the chain is too long. Don't cut it yet though.
Next, shift to big big using the shifters. As long as you have followed the adjusting and checking above, the chain will now be at full stretch. It should look very similar to your picture, albeit on the 36t, not the one below it. If it is still hanging g downwards by more than a few degrees, then the chain is too long. If it is horizontal and there is no sign of even a slight S shape to the chain running through the mech, it's too short.
Now comes the trial and error bit. What if it's bang on in big to big, but too slack in small small? You may be able to adjust the tension using the B tension screw to put a bit in and take up the slack, but you'll need to check clearance in big big again .
If it's slack in big big AND small small, remove one link and try again.
Once you're happy try all of the above in all combinations to make sure there isn't a clash in any combination. Avoid cross chaining when riding at all costs, but occasionally we get it wrong, and you need to know that if you do the mech isnt going to mangle itself in a shower of expensive components.
Basically you're at the limits using a 50 front ring with a 36 cassette. If you can't find the combination you need, try a 34 cassette or put the old 48 back on. MTBs aren't really meant to run at 50-11. That equates to well over 40mph with a half decent cadence.