When did I ovulate and what days did I have to have sex?

If I'm due on July 4th when did I ovulate and when did I have to have sex?? 
Also is a 13 week ultrasound the more accurate due date or should I go by my due LMP? This is confusing