My guess is that you have a bad engine wiring harness.
It could also be a bad coil wire or bad resistor boots.
It could also be a bad throttle actuator or a bad mass air meter.
It could be a combination of any of the above.
There is an unbelieveable amount of info in the archives on all of the above.
I would start out with a search for "engine wiring harness".
2001 E430, Bourdeaux Red, Oyster interior.
1973 280SE 4.5, 170,000 miles. 568 Signal Red, Black MB Tex. "The Red Baron".