Sex after miscarriage

How soon after your bleeding has stopping from your miscarriage can you have sex?