A Theory of Technical Trading Using Moving Averages