Actually to be honest, tank shells can be dodged. Not really easily, but one of the things tankers are trained to do is move often. Engagement ranges can extend out to 4,000 meters, though 1,500-2,000 is more common.
On the flipside, the kinetic energy in a tank shell is equal to around 9MJ. It's estimated that you need about 18MJ's of energy to reliably penetrate modern tank armour. The recoil from an 18MJ weapon is abhorrent, a mech would have to brace itself on a knee, or perhaps even go prone, to avoid toppling over. Especially if it weighs less than 10 tons.
In all honesty, a mech would never, ever be able to take a direct SABOT or HEAT round without severe damage. There are three tenets of armoured combat: Protection, Maneuverability, and Firepower.
Mechs should focus primarily on maneuverability and firepower. Protection in significant amounts is impossible simply by design. The AH-64 Apache is armoured against 23mm fire around the crew compartments, and 12.7mm fire everywhere else. It weighs 9.6 metric tons.