I tend to always fire from 1000m if I can,or as close as 300 - 500m in low visibility like fog,or a dark stormy night.
Not sure why you have more success the further out you are,but I know the minimum range is 300m (any closer and the torpedo will not arm),and I would have to say the maximum range would be about 8000m,or the limit of visibility range.When you get radar you may even be able to fire beyond this range,but the chances of hitting anything would virtually be nil.Its always better to get closer for two main reasons:
1 - the closer you are the less time the target ship will have to evade and zig zag
2 - even if the torpedo should lose its depth it
should still hit the target
In real life most commanders fired from about 600m,in an ideal situation that is.
I recommend the following book,a lot of technical information is in it,there is even a section on attacking distances
http://www.amazon.co.uk/U-Boat-Comma.../dp/0939631210