Clomid would not have caused your ectopic pregnancy. It's your age, not the fertility treatments, that make you more prone to this condition. Ectopic pregnancies happen when the fertilized egg implants itself somewhere other than the uterus, often in the fallopian tubes. According to the American Pregnancy Association, women between the ages of 35 and 44 have a greater risk than younger women. In addition to age, other factors involved might cause an ectopic pregnancy, such as scar tissue in your fallopian tubes or infection.
The two previous miscarriages may point to some immunological problem, so be sure to ask your healthcare provider to refer you to an infertility specialist for an opinion.