Exit planningRisk managementAutomationAgentic trading

How to build an exit plan that automates take profits and stop losses

An automated exit plan needs clear price targets, time limits, and a kill switch. This checklist covers take profits and stop losses while keeping the owner in control.

By the Felix team11 min read
Key takeaways
  • 01An exit plan must define the take-profit level, stop-loss level, time limit, and maximum loss in dollars before any position opens.
  • 02A stop loss on a single trade does not protect the total account budget unless it is paired with global spending caps and a kill switch.
  • 03Take-profit targets should be based on market structure and volatility, not on the amount of money the owner wants to make.
  • 04Every exit plan should be tested in paper trading to verify that the agent actually follows the rules when the market moves against it.
  • 05The owner should review the plan at set intervals, not after every trade, and update it only after testing the changes in simulation.

An automated exit plan tells the agent exactly when to close a position, whether it is ahead or behind. Without one, the agent can hold a losing trade past its budget or give back gains because no target was set. The plan must include a take-profit level, a stop-loss level, a time limit, and a kill switch the owner controls. These rules should be set before the position opens, because changing them during a trade often leads to worse decisions.

What should an exit plan define before a position opens?

Before the agent sends its first order, the exit plan must state the intended hold period, the price at which it will take profit, the price at which it will cut losses, and the maximum dollar amount it can lose on that single position. This is not a vague intention. It is a concrete instruction set that the agent checks against every tick. The owner should decide these values, not the agent, because the owner understands the total portfolio context and the hard budget that the agent cannot exceed. If the agent is allowed to improvise exits, it may widen a stop loss to avoid admitting a loss, or it may exit early out of noise that the owner would have ignored.

The plan should also state whether the exit is a market order or a limit order. A market order guarantees exit but not price. A limit order guarantees price but not execution. For take-profit levels, a limit order is common. For stop losses, a market order is often safer in fast markets because a limit stop might fail to fill. The owner should also decide if partial exits are allowed. Scaling out half the position at the first target and letting the rest run is a valid strategy, but the agent must know the exact percentages and the revised stop loss for the remaining shares. Leaving this undefined means the agent will either freeze or make an arbitrary choice.

If the agent runs multiple positions, the plan should state whether stops are independent or correlated. Five positions in the same sector may all hit stops at the same time, turning a single planned loss into a drawdown that breaches the weekly budget. The owner should either diversify the entry signals or set tighter per-position limits when correlation is high. A good exit plan treats the portfolio as a whole, not as a collection of isolated trades.

How do you set take-profit levels the agent can actually reach?

Take-profit levels should be based on the market structure, not on the amount of money the owner wants to make. A target that is ten percent away in a stock might be reasonable, while the same percentage in a perps venue might be a normal daily move. The agent does not feel hope or fear, but it will follow a bad target literally. The owner should set targets by looking at recent range, volatility, and liquidity, not by working backward from a desired account balance.

Because Felix sizes orders in plain US dollars, the owner can think in dollar terms rather than contract units. A two-thousand-dollar position with a five-percent target is a one-hundred-dollar profit target. The agent sees that same math. This normalization helps when the agent trades across multiple venues, each with different margin rules and tick sizes. The owner should still verify that the target is not sitting inside the spread or beyond the order book depth. A take-profit order that is too ambitious becomes a wish, not a plan.

If the owner wants to trail a stop instead of a fixed target, the plan must define the trail distance in dollars and the step size. A vague instruction to let winners run will not execute. The agent needs a concrete rule, such as raising the stop by ten dollars for every twenty dollars of profit. The owner should also state whether the trail starts immediately or only after the first target is reached. Undefined trailing rules often lead to the agent giving back all profits during a normal retracement.

The owner should also state whether the take-profit is a single level or a ladder. Laddering out of a position at three separate targets reduces the variance of the outcome, but it also requires the agent to manage three separate orders. The plan must specify the size at each rung and whether the stop loss moves up after each partial exit. A ladder without a revised stop can leave the owner exposed on the remaining shares.

Why is a stop loss only part of the exit story?

A stop loss limits the loss on one position, but it does not limit the loss on the whole account. Trading can lose money, including everything, so an agent can hit five stop losses in a row and still breach its weekly budget. The exit plan must therefore connect the single-position stop to the broader guardrails that cap total spending. The owner should set a daily or weekly drawdown limit that flattens all positions and revokes the key once breached. This is the difference between losing a planned amount on one trade and losing an unplanned amount on ten.

Time is another exit trigger that many owners forget. A position opened for a day-trade that is still open three days later has become a different trade. The exit plan should state a maximum hold time, after which the agent closes the position regardless of profit or loss. This prevents the agent from rationalizing a losing trade as a long-term investment. The plan should also specify what happens around known events, such as earnings announcements or contract expirations. Holding an option into expiration without a plan is a common way to turn a small trade into a total loss. The exit plan should state the last acceptable exit time before such events.

Gap risk is another factor. A stop loss order does not guarantee execution at the stop price. In a fast market, the price can gap past the stop, and the fill may be far worse than planned. The owner should keep position sizes small enough that a single gap cannot destroy the budget. Some owners add a maximum slippage tolerance, but in a true gap even that may not protect them. The only reliable protection is size control and a hard budget cap that halts trading before the damage compounds.

What safety controls prevent an agent from ignoring the plan?

The best exit plan is useless if the agent can override it. Felix uses scoped keys and owner-approved controls that the agent cannot disable. The owner sets a hard budget when authorizing the key, and the agent cannot spend past it. The owner also sets a panic switch that flattens every position and revokes access. These controls live outside the agent, so even a misbehaving model cannot turn them off. The agent can spend within limits, but it can never withdraw funds to itself or steal.

The owner should also require that the agent logs every intended exit before the position opens. This creates an audit trail. If the agent later tries to cancel a stop order or move a take-profit further away, the owner can see the change and decide whether to revoke the key. Some owners choose to set the exit orders themselves through the API and let the agent only manage entries. This is a valid hybrid approach. The key point is that the owner retains control. Securing an AI trading agent without giving up custody means the exit plan is enforced by infrastructure, not by the agent's good behavior.

Scoped keys can also restrict which markets the agent accesses and whether it can use leverage. A key scoped to spot markets only cannot accidentally open a leveraged perps venue position. Position limits prevent the agent from doubling down on a losing trade by adding to it. These limits should be set in plain dollars so the owner does not need to calculate contract multipliers. The API normalizes the math, but the owner should still verify that the limits make sense for the specific markets in the plan.

How do you test an exit plan without losing money?

Every exit plan should run through paper trading before it touches live capital. Felix provides a paper environment where the agent executes the same logic against real market data without real money at risk. The owner should watch not only whether the agent hits its targets, but whether it respects the plan when the market moves against it. A common failure is that the agent cancels a stop loss to avoid a small loss, then suffers a larger one. Paper trading reveals this flaw without cost.

The owner should also backtest the exit rules on historical data for the specific markets the agent will trade. A stop loss that works in a stock may be too tight in a perps venue. The owner should look at the frequency of stop hits, the average time in winning trades versus losing trades, and the total slippage. Building a trading agent that handles real money safely requires proving the exit plan in simulation first. Only after the agent demonstrates consistent obedience to the plan should the owner authorize a live key with a small budget.

Paper trading also tests the integration between the agent and the API. An exit plan that relies on a specific order type may fail if the agent constructs the request incorrectly. The owner should verify that take-profit and stop-loss orders are attached to the right positions and that cancellations update the plan as intended. A bug in the agent's logic is cheaper to fix in paper mode than in live trading. The owner should run the paper test for at least the length of the intended hold period. A day-trading plan needs only a few days of paper testing, while a swing plan needs weeks. Short tests often miss the tail events that expose weak exits.

How should an owner review and update an exit plan?

Markets change, and an exit plan that worked last quarter may be too loose or too tight today. The owner should review the plan after a fixed number of trades, not after every trade. Reviewing after every trade leads to curve fitting. A monthly or quarterly review is usually enough. During the review, the owner should check the ratio of stop losses hit to take profits hit, the average slippage on exits, and whether the agent ever held past the time limit.

Updates should be made in writing, not verbally to the agent. If the owner uses an MCP client, the updated plan should be committed to the agent's context or system prompt. The owner should then run the updated plan through paper trading again before renewing the live budget. An exit plan is a living document, but it should not change in the middle of a position. If the owner wants to change the plan, the safest approach is to close the position manually, update the rules, and let the agent start fresh.

The owner should also keep a version history of the plan. Comparing the current version to past versions makes it easier to spot whether recent changes improved the outcome or just fit the last few trades. A disciplined review process separates luck from edge. If the plan consistently underperforms, the problem may be the strategy itself, not the exit rules. In that case, the owner should reduce the budget or return to paper trading until the logic is sound.

Frequently asked questions

Can an agent change its own exit plan during a trade?

An agent should not be able to change the exit plan without owner approval. The owner should set scoped keys and require that any modification to a stop or target is logged and flagged. If the agent attempts to cancel a stop order to avoid a loss, the owner can revoke the key immediately.

Should the owner set exit orders before the agent enters the position?

Yes, setting exits before entry removes discretion during the trade. The owner can place the orders manually or instruct the agent to attach them immediately upon fill. This prevents the agent from rationalizing a delay or widening a stop loss after the position moves against it.

What happens if a market gaps past the stop loss?

A stop loss order becomes a market order once the stop price is touched, but it fills at the next available price. If the market gaps far past the stop, the loss can exceed the planned amount. Owners should account for this possibility by keeping position sizes small enough that a single gap cannot breach the total budget.

Does paper trading test exit slippage accurately?

Paper trading simulates fills at the last traded price or a reasonable estimate, but it cannot replicate the exact liquidity of a live order book during a crash. It is useful for testing whether the agent follows the plan, not for predicting exact slippage. Owners should assume live slippage will be worse than paper results.

How often should an owner update the exit plan?

The owner should review the plan after a fixed batch of trades or at a set calendar interval, such as monthly. Updating too frequently leads to curve fitting, while never updating lets the plan drift out of step with market conditions. Any change should be tested in paper trading before going live.

Can an agent hold a position past its time limit if it is profitable?

No, the time limit should apply regardless of profit or loss. A trade that was planned for one day and is held for a week has become a different trade with a different risk profile. The exit plan should instruct the agent to close the position when the clock expires, unless the owner manually intervenes with a new plan.

Give your agent a key.

One key to trade stocks, crypto, perps, options, and prediction markets. Live after owner authorization.

Keep reading

Not a brokerage, exchange, or investment adviser. Not investment advice. Trading involves risk, including total loss.