OpenClaw Tutorials7 min read

Six Exit Reasons, Three Carrying the Weight

S

Suneet Malhotra

May 19, 2026

1 views
Six Exit Reasons, Three Carrying the Weight - OpenClaw Tutorials blog post

The stock engine writes one line to the trade log per closed position. The line includes an entry price, an exit price, a P&L, and a field called exit_reason, which is one of six values. I had been treating those six values as a black box. The take-profit and the stop-loss were the rules I reasoned about. The other four I had configured once and never looked at again.

This weekend I pulled the exit-reason field for every closed trade in the last sixty paper sessions. Roughly a hundred closures. The distribution was not what I expected.

What I expected

If you had asked me on Friday to guess the breakdown, I would have said forty percent take-profit, thirty percent stop-loss, and the other four exit reasons splitting the remaining thirty percent. That mental model came from how I think about the rules. The take-profit is the headline rule, the plus five percent target I wrote a post defending a week ago. The stop-loss is the safety rule, the minus three percent protective bracket on every order. The other four are infrastructure: a trailing stop that activates after the trade goes green by three percent, a time-stop that fires at five days held, a behavioral exit that closes a position when the underlying breaks its 200 SMA or sits more than twenty percent off its 52-week high for two sessions, and a circuit-breaker close-out that fires if the daily loss limit gets hit.

Mental model: the two headline rules do the work. The infrastructure is there to catch edge cases.

What I actually found

The take-profit fired on roughly thirty-eight percent of closures. That matches the count I published last week. The stop-loss fired on closer to fifteen percent. The trailing stop fired on twenty-eight percent. The time-stop fired on twelve percent. The behavioral exit fired on five percent. The daily-loss-limit close-out fired twice across sixty sessions. Once on March 11 and once on April 9.

The trailing stop is doing more work than the stop-loss by almost two to one. That was the surprise.

Why the trailing stop matters more than I thought

The trailing stop has two phases. Phase one: the trade is open and not yet up three percent. The rule is dormant. Phase two: the trade hits plus three percent, the rule activates, and the trail rides two percent below the high-water mark. From that point on, the position exits either at the take-profit or when price retraces two percent from its peak, whichever fires first.

When I read the trailing-stop closures one by one, the median exit was at plus 2.8R above entry. The median take-profit exit was at plus 1.0R, which is the deterministic plus five percent target. The mean R-multiple for trailing-stop exits was lower than the median because of a long left tail. Trailing stops that activated at exactly plus three percent and got chopped back to plus one percent on the same day.

What this means in practice: the trailing stop is the rule that turns medium winners into above-target winners. The take-profit captures the clean plus five percent moves. The trailing stop captures the rare moves that go plus six, plus eight, plus twelve percent and then peel back. The right-tail of the R-multiple curve depends on the trailing stop more than on the take-profit.

I had not seen this because the take-profit fires more often, and "more often" was the metric I had in my head.

Why the stop-loss fires less than I expected

The stop-loss firing on fifteen percent of closures means roughly one in seven closures hits the minus three percent bracket. The other eighty-five percent never get that far down. Two reasons. First, the engine's entry filter (SMA20 over SMA50, RSI under 70, MACD histogram above zero, volume above 1.2x the twenty-day average) is restrictive enough that bad entries are rare. Second, the trailing stop, the time-stop, and the behavioral exit collectively close losing or slow-bleeding positions before they reach the minus three percent line.

The time-stop in particular is a quiet hero. Twelve percent of closures fire at the five-day time-out, and when I pulled the P&L distribution of time-stop closures, the median was approximately minus 0.2R. Slightly negative, not catastrophic. These are positions that were never going to reach the take-profit and were grinding sideways. If the time-stop did not fire, most of these would either eventually hit the minus three percent stop (worse outcome) or get blown out by a behavioral exit on a 200 SMA break (worse, and slower). Five days is, on this sample, a reasonable cap.

What I am going to do with this

Three changes, in priority order.

First, the trailing stop deserves a finer parameterization than the one-size two percent rule. Different regimes produce different intraday vol. A two percent trail in a low-vol compression regime gets stopped out earlier than it should, and a two percent trail in a high-vol expansion regime lets too much of the move slip. I am going to log the regime classification at the time the trailing stop activates and at the exit, and look at whether a regime-conditioned trail (two percent in low-vol, three percent in normal, four percent in high-vol) would have produced a different P&L curve on the same sixty sessions.

Second, the time-stop is set at five days globally. The median hold time before the time-stop fires is also five days, which means the cap is binding. I want to look at whether stretching the cap to seven days for the highest-conviction signals would convert any of the time-stop closures into take-profit or trailing-stop closures. If the answer is no, the cap stays. If even one in five converts to a profitable close, the cap shifts.

Third, I am adding an exit-reason breakdown to the daily Telegram message. Right now Telegram shows trades open, trades closed, net P&L, win rate. Adding a one-line distribution of exit reasons over the trailing twenty closures will make this kind of audit visible weekly instead of quarterly.

What I am not going to do

I am not going to widen the plus five percent take-profit on the basis of this data. The take-profit's job, as I argued last week, is variance control, not return maximization. Trailing-stop closures running higher R than take-profit closures does not refute that. It says that the trailing stop is, in fact, the rule that captures the upside. The take-profit is the rule that prevents one in three winners from rolling back to flat.

Both rules are doing different jobs. Both are paying their freight. The thing the audit changed was my ranking of which rule did what.

The general point

Most of the rules in a trading engine are not load-bearing in the way the documentation describes. The documentation lists six exit conditions and treats them as peers. The exit-reason distribution does not. Three rules close roughly eighty percent of trades. Three close the remaining twenty percent. The bottom three are not unimportant. The circuit breaker fired twice and both times was the difference between a minus two percent day and a minus four percent day. But they are not load-bearing in the day-to-day.

If you are running a system with more than two exit conditions, count which one fires. If you have not done it recently, you probably have a rule in your head that fires rarely and a rule in your head that fires constantly, and you are reasoning about both of them as if they fire equally. That is the cheapest audit on a Tuesday morning, and the one most likely to change a parameter you would not otherwise have touched.

Share this post

You Might Also Like

Stay in the Loop

Get weekly insights on AI-driven QA, engineering leadership, and automation strategies.

No spam, ever. Unsubscribe anytime.