What is a take-profit order?

A take-profit order is a pre-set instruction to close a position automatically once price reaches a chosen profit target. It is the mirror image of a stop-loss: where a stop caps your loss, a take-profit captures your gain before the market hands it back. For a trading bot this matters enormously — bots have no patience and no greed, so a hard take-profit level encodes your exit plan as code that fires the instant the target prints, with no second-guessing. This guide explains exactly how a take-profit order works, how a bot places one with ccxt, and how to choose and backtest the level so it actually improves your edge instead of clipping winners too early.

On this page
  1. What it is
  2. How it works
  3. Placing one in code
  4. Choosing the level
  5. Common mistakes
  6. Getting started
  7. FAQ

What a take-profit order is

A take-profit (TP) order is a resting limit order placed in advance at a price better than your entry — above entry for a long, below entry for a short. When the market trades through that price, the order fills and your position closes in profit. You decide the target once, at entry, and the exchange enforces it whether or not you are watching. It is the natural partner of the stop-loss: together they define a complete, bounded trade with a known maximum gain and maximum loss before you ever enter.

Take-profit (limit) — close in profit Entry Stop-loss — cap the loss
A take-profit brackets a trade on the upside; the stop-loss brackets it on the downside. The bot exits at whichever it hits first.

How it works on the exchange

Most exchanges implement a take-profit as a limit order sitting in the order book at your target. Because it is a maker order, it typically earns the lower maker fee and fills at exactly your price (or better) — but it only fills if price actually reaches it. Some venues also offer a "take-profit market" order that converts to a market order on touch, guaranteeing the exit but paying the taker fee and accepting some slippage. A bot usually places the TP as an OCO ("one-cancels-other") pair with the stop, so when one side fills the other is cancelled automatically.

Placing a take-profit in code

With ccxt you place a take-profit as a limit sell (for a long) at your target price. The same loop covered in the crypto bot guide places the entry, then immediately attaches the exit bracket.

python · take_profit.pyimport ccxt

ex = ccxt.binance({'apiKey': KEY, 'secret': SECRET})
entry = 100.0
amount = 0.01
tp_pct = 0.06          # +6% take-profit target
tp_price = round(entry * (1 + tp_pct), 2)

# resting limit sell = take-profit for a long position
ex.create_limit_sell_order('BTC/USDT', amount, tp_price)
print(f'TP armed at {tp_price}')

Pair this with the stop-loss from stop-loss vs take-profit so every position has both exits armed the moment it opens.

Choosing the take-profit level

The level should come from your risk-reward ratio, not a round number. If your stop is 2% away and you want a 2:1 reward-to-risk trade, your take-profit is 4% away. Volatility-based targets — a multiple of ATR, or the next structural resistance level — adapt better than a fixed percentage. Whatever you choose, prove it on the strategy backtester and confirm the expectancy on the win-rate profit calculator before going live.

A take-profit is a trade-off, not free money

A tight TP raises your win rate but caps your winners, so a few big trends can no longer pay for many small losses. A wide TP captures trends but lowers your hit rate. There is no universally "right" level — only the one your backtest shows produces the best risk-adjusted return for your strategy and market.

Common mistakes

Setting the same fixed-percentage TP on every market regardless of volatility; placing it so tight that fees and spread eat the gain; cancelling a take-profit manually in a strong trend (defeating the whole point of automating discipline); and forgetting to cancel the paired stop after the TP fills, which can leave a stray order that opens an unintended new position.

Getting started safely

Decide your TP and stop before entry from your risk-reward plan, arm both as a bracket the moment the position opens, paper trade the full exit logic against live data, and only then go live at the smallest size.

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 a take-profit order in simple terms?

A take-profit order is an instruction you set in advance to automatically close a position once price reaches a chosen profit target. For a long position it is a limit order placed above your entry; when the market trades up to that price, the order fills and you lock in the gain without having to watch the market or decide in the moment.

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

They are opposite exits that bracket the same trade. A take-profit closes the position at a price better than entry to capture a gain, while a stop-loss closes it at a price worse than entry to cap a loss. Together they define a complete trade with a known maximum profit and maximum loss, and a bot exits at whichever level price reaches first.

How does a trading bot place a take-profit order?

A bot places a take-profit as a resting limit order at the target price using a library like ccxt — for a long, a create_limit_sell_order at the target. It is usually attached as an OCO bracket with the stop-loss so that when one exit fills, the other is cancelled automatically. This encodes your exit plan as code that fires the instant the target prints.

Where should I set my take-profit level?

Base it on your risk-reward ratio rather than a round number. If your stop is 2% away and you want a 2:1 trade, the take-profit is 4% away. Volatility-based targets, such as an ATR multiple or the next structural resistance, adapt better than a fixed percentage. Always backtest the level — a tight target raises win rate but caps winners, a wide one does the reverse.

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.