Chemical pregnancy/early miscarriage

Can someone please explain to me what happened when you had a chemical pregnancy? I think I'm having one. I don't know how to know for sure though. I got a positive pregnancy test today but I am bleeding now. If it is an early miscarriage when will my tests stop being positive?