Automatic closes are almost always a rule you set (or agreed to)
If a position closed without you clicking anything, the platform did it for one of a few defined reasons. It is rarely a glitch. The three usual culprits are a stop-loss you placed, a broker stop-out because your account ran low on margin, or an expiry/rollover on certain instruments.
The fix starts with reading your trade history. Regulated platforms log the reason a position closed — 'sl' for stop-loss, 'so' or a margin note for stop-out, and so on. Identifying the reason tells you exactly what to change.
Stop-loss triggered
If you set a stop-loss, the platform closed the trade when price reached it. That is the stop doing its job — capping your loss — even if it stings. Sometimes price 'wicks' briefly to your level and then reverses, which feels unfair, but the stop simply executed the instruction you gave.
If you are being stopped out constantly, the usual cause is a stop placed too tight for the market's normal movement, so ordinary noise hits it. Widening the stop while trading a smaller position keeps the same total risk but gives the trade room to breathe.
Margin stop-out
If you had no stop-loss but the trade still closed, your account likely hit the broker's stop-out level. When losses eat into your usable margin past a set point, the broker force-closes positions to stop your balance going negative. This is the margin-call/stop-out mechanism, and it typically strikes when a position is too large for the account and moving against you.
The remedy is position sizing and leverage discipline: trade smaller, use less leverage, and keep spare margin so a normal move cannot push you to the stop-out level. Our guides on margin calls and stop-outs cover the maths.
Expiry, rollover, and other causes
Some instruments — certain futures-based or dated CFD products — expire or roll over on a schedule, closing your position automatically at that time. Others close if you accepted terms that liquidate positions under specific conditions. Check the instrument's contract details so these never surprise you.
Whatever the cause, the takeaway is the same: automatic closes are the system following rules. Learn which rule closed your trade, and you can adjust your stops, sizing, or instrument choice so it happens on your terms, not by accident.