Why is there an immediate price drop after orders are placed?

I wrote an algorithm to predict bouncebacks after a spike falls. It seems to be working (in paper trading), but there is always a straight-line drop in value after the buy orders are placed. Does anyone know what the initial drop is caused by? It happens every day in the same way.

If you’re placing market orders, then your orders are getting filled at the ask price which is above market value. The same thing happens if you placed a market sell, which is filled at the bid price and could be lower than you expected.

I found a quick article about it https://www.etoro.com/customer-service/help/1458558372/why-is-there-a-loss-as-soon-as-i-open-a-trade/