cTrader

AlgoWay Blog

Guides, manuals and platform references.

Core
JSON & Alerts
MT5 / Expert Advisors
Errors
Integrations
Other Publications
AlgoWay Strategy Lab

Partial Take Profits: Calculate the Whole Trade Payoff

A position split between an early profit target and a later target with a balance showing combined payoff

Selling half a position at a profit feels like putting money in a safe drawer. The arithmetic is less sentimental: that half can no longer earn the final target. Partial exits exchange some participation in a large winner for a better result on certain reversals.

Calculate a scaled-out trade by weighting each exit's return by the fraction of the original position closed there. Keep the initial risk denominator fixed. A final target three times the stop distance does not make the whole trade a 3R winner when half the position left earlier.

This matters in automated trading because exit quantities are part of the strategy, not merely administrative details. Before comparing an AlgoWay workflow with a backtest, reconcile the actual quantities and prices of every exit. The AlgoWay expectancy guide explains why the trade definition and cost basis must remain consistent; the examples below show how to build the payoff for one entry with several exits.

Use the original position as the denominator

Assume a hypothetical long trade of 100 shares entered at $100, with an initial stop at $98. Its planned price risk is $200: 100 shares multiplied by $2. Call that amount 1R. For this illustration, fills occur exactly at the stated prices, all shares share one entry price, and fees, financing and slippage are excluded. These are arithmetic examples, not tested strategy results.

Close 50 shares at $102, then the other 50 at $106. The first exit earns $100; the second earns $300. The whole trade earns $400, or 2R, even though the last fill is at a price 3R above entry.

Whole-trade gross R = sum of (fraction of original size closed × exit distance in initial stop units)

Here the calculation is 0.50 × 1 + 0.50 × 3 = 2R. With 25% closed at 1R and 75% at 3R, it becomes 2.5R. With everything held to 3R, it is 3R. The position fractions must add to one once the trade is completely closed. If some size remains open, label that exposure separately instead of treating unrealized profit as a completed result.

The route to the exit changes the comparison

Compare two policies with the same entry and original stop: hold everything for 3R, or take half at 1R and leave half for 3R. Neither policy moves the stop. Assume the price paths and exact fills described below.

Price path after entryHold all for 3RHalf at 1R, half at 3R
Original stop before the first target−1R−1R
First target, then original stop−1R0.5 × 1 + 0.5 × (−1) = 0R
First target, then final target before the stop+3R+2R

Scaling out gains 1R relative to holding on the reversal path and gives up 1R on the continuation path. It does nothing to improve the full losses that occur before the first target. Whether that exchange is useful depends on how often each path occurs, not on the reassuring sound of “locking in profit.”

Let q be the fraction of first-target hits that subsequently reach 3R before the original stop, under these exact assumptions. Among those first-target hits, holding has an average gross payoff of 3q − (1 − q) = 4q − 1. Scaling out has 2q + 0 × (1 − q) = 2q. The two are equal when q is 50%.

That 50% is a property of this invented payoff schedule, not an estimate for any market. It is conditional on reaching the first target and is not the strategy's overall win rate. Different targets, fractions, costs or stop rules change the comparison. To calculate the full strategy average, include entries that never reach the first target as well.

Moving the remaining stop is another experiment

If the first half exits at 1R and the second half later closes at entry, the gross result is 0.5R. That is different from the 0R reversal row above. But a stop moved to entry can also close a runner that would otherwise have survived a retracement and reached 3R.

Do not replace only the losing row in a spreadsheet and leave the continuation frequency untouched. Re-evaluate the price paths using the new stop rule. An exit at entry can still lose money after costs, and the initial 1R denominator remains $200 even after the position's remaining exposure shrinks.

Make the execution quantities match the payoff model

In Pine, TradingView documents partial exits using multiple strategy.exit() calls with qty or qty_percent. Those calls reserve portions of the position, so a later call cannot close size already reserved by an earlier one. Check the simulated fills rather than inferring the result from two target lines.

For an execution plan, convert percentages to explicit intended quantities. With ten initial units, two exits of five units flatten the position. Closing 50% of the remaining size twice would instead close five and then 2.5 units, leaving 2.5. This is arithmetic, not a claim about how a particular connector interprets its fields. Confirm the destination's quantity rules and whether the requested portions are executable.

Finally, calculate net payoff from actual cash profit minus all applicable costs, divided by the original cash risk. More exit orders can change costs under per-order pricing; per-unit pricing behaves differently. The commission-model guide covers that distinction. Record one complete entry-to-flat result alongside its individual fills, then compare exit policies on the same entries. The final target is only one line of the receipt.

Last updated: October 16, 2026