Skip to content
All library documents

Using Competing-Risks Survival Models to Manage Trade Exits

Article MQL5 articles

Summary

The article models an open trade’s exit as a discrete-time survival problem. At each bar, a position can hit its take-profit, hit its stop-loss, or remain open; a time-stop position is treated as censored. It fits two cause-specific hazards with multinomial logistic regression, then combines them into cumulative incidence estimates to guide whether to hold or close. The model uses nine time-varying features, including unrealized return, excursions, barrier distances, volatility, range position, and trend alignment. The article also explains how to build a person-period training table without leaking information from the bar being predicted.

A native MQL5 implementation uses penalized maximum likelihood, chronological trade-level holdout data, and calibration comparisons against a time-only baseline. In tests across four instruments, survival-managed exits improved results on two and weakened them on two; the pooled average lost more than the fixed-exit approach. The fixed entry rule was deliberately held constant and described as weak, so the reported results concern exit management in that setup. They do not establish that the method generalizes or is profitable across markets.

Key ideas

  • Competing risks distinguish take-profit and stop-loss events because either event makes the other impossible.
  • A position still open at its time limit is censored rather than labeled a loss.
  • Time-varying features let the model update exit probabilities as the trade and market evolve.
  • Cumulative incidence accounts for the chance a trade survives long enough to experience each exit.
  • The four-instrument comparison was mixed, so the approach did not outperform fixed exits consistently.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.