I already experienced a couple of times on a demo account I am practicing on that when I open a new position with a TP that it opens the position on a price where the present price is not and it equals in the TP becoming the SL.
I close the position and try to reopen another one but it reacts exactly the same.
Does somebody know how this can happen and what the solution is for this problem?
This should be the spread I guess. If you are opening a BUY order it is opened by the ASK price and while most probably the chart you are looking at is generated by the BID price. This being said, if you are trading an instrument with a wider spread and you are looking on the chart you might be getting confused of what is the actual price at which the order is supposed to get opened:
Example: you want to open a BUY order on BTCUSD; you see on the chart a price of 7990 but when you click on BUY the trade is placed with an opening price of 8010 because the spread at that time has been $30.
However, you should not be able to place initially the SL or TP in the spread, thus I assume you are opening the trade without SL/TP and setting a TP after that, when the TP can also be set on level which will close the trade with a loss if triggered, despite this level being a TP.
A screenshot indeed would be useful here, so that we don’t have to make blind guesses on what you are actually doing