A trade has three prices: where you enter, where your stop is, and where you take profit. From those three numbers alone you can answer a useful question: how often does this setup have to win just to break even?
This post computes that number in TypeScript, includes trading fees, and shows why fees hurt most when the stop is close to the entry.
Disclosure: I am the founder of copy.top. We publish a free copy trading calculator that shows the break-even win rate from an average win and an average loss. The code below is a minimal version written for this article.
The formula
Four inputs:
-
entry: the entry price -
stop: the stop loss price -
target: the take profit price -
feePct: total fees for the round trip (buy and sell), as a percent of the entry price
Per coin:
fee = feePct / 100 * entry win = |target - entry| - fee // profit when the target is hit loss = |entry - stop| + fee // loss when the stop is hit R = win / loss // reward to risk breakEvenRate = 1 / (1 + R) Why 1 / (1 + R)? If the setup wins with probability p, the expected result of one trade is p * win - (1 - p) * loss. Setting that to zero gives p = loss / (win + loss). Divide the top and the bottom by loss and you get 1 / (1 + R).
The code
interface BreakEvenInput { entry: number; stop: number; target: number; feePct: number; // round trip fees, % of the entry price } interface BreakEvenResult { side: "long" | "short"; win: number; // profit per coin at the target, after fees loss: number; // loss per coin at the stop, fees included R: number; // win / loss rate: number; // minimum win rate to break even (0 to 1) } export function breakEven(i: BreakEvenInput): BreakEvenResult { if (!(i.entry > 0 && i.stop > 0 && i.target > 0)) { throw new RangeError("prices must be positive"); } if (i.entry === i.stop) { throw new RangeError("entry and stop must differ"); } const long = i.stop < i.entry; if (long ? i.target <= i.entry : i.target >= i.entry) { throw new RangeError("target must be on the other side of entry from the stop"); } const fee = ((i.feePct > 0 ? i.feePct : 0) / 100) * i.entry; const win = Math.abs(i.target - i.entry) - fee; const loss = Math.abs(i.entry - i.stop) + fee; if (win <= 0) { throw new RangeError("fees are larger than the move to the target"); } const R = win / loss; return { side: long ? "long" : "short", win, loss, R, rate: 1 / (1 + R) }; } The side comes from where the stop is: a stop below the entry means long, above means short. The target has to be on the other side, otherwise the function throws instead of returning a number that means nothing.
The last check matters too. If the fees are larger than the distance to the target, the setup can never break even, even if it wins every time.
Examples
breakEven({ entry: 0.5, stop: 0.45, target: 0.65, feePct: 0 }); // R ≈ 3, rate ≈ 0.25: it has to win 25% of the time breakEven({ entry: 0.5, stop: 0.45, target: 0.65, feePct: 1 }); // R ≈ 2.64, rate ≈ 0.275: 27.5% Now keep the same 3 to 1 shape, but with a much tighter stop:
breakEven({ entry: 0.5, stop: 0.49, target: 0.53, feePct: 0 }); // R = 3, rate = 0.25 breakEven({ entry: 0.5, stop: 0.49, target: 0.53, feePct: 1 }); // R ≈ 1.67, rate ≈ 0.375: 37.5% On a chart the two setups look the same: both are 3 to 1. With a 1% fee, the tight one has to win 37.5% of the time instead of 27.5%. The fee is a fixed amount per coin, and when the distance to the stop is small, the fee becomes a large part of every loss.
A short gives the mirror result:
breakEven({ entry: 0.5, stop: 0.55, target: 0.35, feePct: 1 }); // side: "short", R ≈ 2.64, rate ≈ 0.275 A note on floating point
What Node actually returns for the first example is R = 3.0000000000000013 and rate = 0.2499999999999999, because 0.5 - 0.45 is not exactly 0.05 in binary. Keep full precision while computing and round only for display:
const pct = (x: number) => (x * 100).toFixed(1) + "%"; pct(0.2499999999999999); // "25.0%" Do not round win or loss before dividing. With a very tight stop, one early rounding can move the result noticeably.
What the number cannot tell you
- It assumes you exit exactly at the stop or at the target. On thin markets the price can jump past the stop, and slippage pushes the break-even rate up.
- It says nothing about your real win rate. That can only be measured from your own trade history, over many trades.
- Beating the break-even rate over a handful of trades proves nothing.
If you only want the numbers, the hosted copy trading calculator is free, with no sign up. Nothing here is financial advice. Trading memecoins is risky, you can lose everything you put in.

