First doc appt

So I went to my first appointment today. I'm 10 weeks, and was expecting an ultrasound but was told I can't get one done until I'm 18 weeks and that's also when they determine the sex of the baby. They only do an ultrasound before 18 weeks if the doctor feels it's a "risky pregnancy" Is this true? I was looking forward to seeing my first ultrasound.