Thank you for you'd question.
usually there is no problem with intercourse during pregnancy. Particularly in early pregnancy there is no evidence that what you do or don't do affects the outcome. Generally doctors advise their patients to avoid intercourse if there is bleeding or pain or if the placenta is low or there is a history of incompetent cervix etc.
I would suggest you seek advice from your obstetrician who will guide you best as they know your complete medical history including that of the previous miscarriage. Till then it might be better to abstain from penetrative sex. There is nothing to stop you being intimate or masturbating each other to orgasm if you wish to. Nether is a risk factor for miscarriage.