3rd chemical pregnancy

I had a miscarriage on May 18th which was my second chemical pregnancy. Now I just got a faint positive test today and I’ve been bleeding for the past 10 days. Does anyone know how I can help prevent this from happening? I keep getting faint tests and then I bleed and miscarry I’ve never made it past 4-5 weeks.