Magnetic torpedoes are trigered by the magnetic field of the ship. That being said if you set the running depth 0.5-1m below the draft value of the target-ship the magnetic pistol will detonate the torpedo. In terms of AOB using magnetic pistols makes life easier as you don't really need to have a "perfect shot". As long as the torpedo finds itself under the ship it will detonate and will do damage.
I hope this clears it for you. If you still have problems give us a shout