Stop-loss vs take-profit: how to set bot exits that work

Entries get all the attention, but exits decide whether a bot survives. The two exits every trade needs are a stop-loss — the price where you admit you are wrong and cut the trade — and a take-profit — the price where you bank the win. A bot without a stop-loss is a time bomb; one bot without a take-profit can give back a winner. The hard part is placement: set them at volatility-based levels, not round numbers, and in a ratio that survives your win rate. This guide covers what each does, how to place them, and the exit code.

On this page
  1. What each exit does
  2. Placing the stop-loss
  3. Placing the take-profit
  4. The risk-reward link
  5. The exit code
  6. Common mistakes
  7. FAQ

What each exit does

A stop-loss caps the downside of a trade by closing it at a predefined loss — it is the single most important risk control a bot has. A take-profit closes a trade at a predefined gain, locking the win and removing the temptation (or the bug) that lets a winner round-trip. Together they define the loss and the reward of every trade before you enter.

Placing the stop-loss

Place the stop where your trade idea is wrong, not at an arbitrary percentage. The robust method is volatility-based: set it a multiple of the Average True Range (ATR) beyond entry, so the stop breathes with the market instead of getting clipped by normal noise. Round-number stops cluster where everyone else’s sit and get hunted.

entry stop (1R) target (2R)
Risk one unit (R) to the stop, target two units to the take-profit — a 2:1 reward-to-risk trade.

Placing the take-profit

The take-profit is usually expressed as a multiple of the stop distance (your risk, “R”). Targeting 2R means you risk one unit to make two. A fixed take-profit caps the winner, which is fine for high-win-rate reversion; for trend strategies a trailing stop often beats a fixed target by letting winners run.

The risk-reward link

Stop and target together set your risk-reward ratio, and that ratio dictates the win rate you need to break even. A 2:1 trade only needs to win about 34% of the time; a 1:1 trade needs 50%. You cannot judge a stop or target in isolation — they live or die together.

The exit code

python · exits.pyatr   = average_true_range(candles, 14)
entry = price
stop  = entry - 2*atr            # 2 ATR below = 1R risk
risk  = entry - stop
take  = entry + 2*risk           # 2R target

if price <= stop:  ex.close('stop-loss')
if price >= take:  ex.close('take-profit')

Common mistakes

The fatal errors

Trading with no stop at all (one trade can erase a year of gains); moving a stop further away to avoid being stopped (turning a small loss into a catastrophe); and a take-profit so tight relative to the stop that the math can never work. Set both before entry, size from the stop with the calculator, and never widen a stop on a live loser.

Not financial advice. This content is educational. Automated and algorithmic trading carries a real risk of financial loss. Never trade money you cannot afford to lose. Review the SEC investor.gov and CFTC resources before trading.

Frequently asked questions

What is the difference between a stop-loss and a take-profit?

A stop-loss closes a trade at a predefined loss to cap the downside, while a take-profit closes it at a predefined gain to lock in the win. The stop-loss is the more critical of the two because a single trade without one can erase a long run of profits.

Where should I place a stop-loss?

Place it where your trade idea is proven wrong, not at an arbitrary percentage or round number. The robust method is volatility-based — a multiple of the Average True Range beyond entry — so the stop breathes with normal market noise instead of being clipped by it or hunted at obvious round levels.

What is a good risk-reward ratio for exits?

A common target is 2:1, risking one unit to the stop to make two units to the take-profit, which only needs about a 34% win rate to break even. The right ratio depends on the strategy: high-win-rate reversion can use a tighter target, while trend-following often prefers a trailing stop over a fixed one.

Should a trading bot always use a stop-loss?

Yes. A bot without a stop-loss is a time bomb — one adverse move can erase a year of gains, especially with leverage. Set both the stop and the target before entry, size the position from the stop, and never widen a stop on a live losing trade.

MB

Mustafa Bilgic

Algorithmic trading practitioner · Founder, AITradingBot.us

Mustafa builds and backtests automated trading systems and writes about them without the hype. Every tool on this site is free and runs entirely in your browser.