Open a position and it often shows a small loss immediately, before the price has done anything at all. Nothing went wrong. You have met the spread — the oldest and quietest cost in the market, and the one that decides whether frequent trading can work.
The bid is the highest price someone will currently pay. The ask is the lowest price someone will currently accept. They are never the same number, and the gap between them is the spread. Buy at the ask, and to get out immediately you would have to sell at the bid — a little lower. That difference is why your position opens red.
Market makers quote both sides continuously and earn the gap in exchange for always being there to trade with. That is a genuine service: without it you would have to wait for a person who wanted exactly the opposite of your trade at the same moment. The spread is the fee for instant liquidity, and you pay it whether or not you notice.
When a broker charges no commission it has not removed this cost, because this cost was never the commission. Round trips still cross the spread twice — once in, once out. On a heavily traded large company the gap is often a cent and effectively irrelevant. On a thinly traded small one it can be a meaningful percentage, and on an illiquid options contract it can be brutal. Trade rarely and it is noise. Trade twenty times a day and it is the dominant term in your results.
Spreads widen exactly when you least want them to: at the open and the close, around news, in fast markets, and in anything thinly traded. This is also when beginners feel most compelled to act. A market order placed into a violent minute can fill considerably further from the last price you saw than you expected — which is where limit orders come in.