Help please!

Chandee

I had a miscarriage on June 25th at 5 weeks pregnant. July 22nd I started spotting for 5 days and it never got heavier than that is was just dark brown mostly which I thought was just dried blood leftover from my miscarriage. Only when I wiped. The day after that ended I started getting cm that was consistent with ovulation. So I did an opk yesterday it was at 26 and then today it is showing 162 peak day. I’m just so confused was that a period or not and how am I ovulating two days after a period?