ApexBound
An ML pipeline that predicts whether a trade setup hits take-profit before stop-loss.

Overview
ApexBound reframes an unpredictable price-direction problem as a well-posed binary classification: given a defined long setup (ATR-based stop, 2R target), does price hit TP before SL within N candles? It engineers 73 causal features, compares 6 model families under embargoed walk-forward validation, and evaluates with both ML metrics (PR/ROC-AUC, calibration, SHAP) and trading metrics (Sharpe, drawdown, profit factor).
Problem
Most retail 'stock prediction' projects regress on price direction which is a low-signal target and quietly leak future information through bad labels and random train/test splits, producing impressive but fake results. There was no clean, reproducible template that gets the methodology right.
Solution
A modular, config-driven Python pipeline using the triple-barrier labeling method, where leakage is prevented structurally at every stage. Causal features are verified by an automated look-ahead guard, an embargo gap is present in every CV fold, fold-local scaling, and an untouched chronological holdout.
Architecture
A registry-based pipeline: OHLCV ingestion (CSV / yfinance / synthetic) → cleaning + validation → triple-barrier labeling → 9 modular feature groups → dataset assembly → time-series CV across 6 model families → evaluation, Optuna tuning, SHAP explainability, and a threshold backtester. Typed config drives every stage; MLflow tracks experiments.
Tech Stack
Challenges
- Preventing look-ahead bias in labels and features — solved with an empirical guard that recomputes each feature on truncated history and asserts it's unchanged.
- Overlapping-label leakage in cross-validation — solved with an embargo gap equal to the label horizon.
- Evaluating honestly on a near-efficient market, where the temptation is to chase a leaky high score instead of reporting the real weak signal.
Lessons Learned
- Leakage must be prevented structurally and tested, not assumed — on random-walk data the pipeline correctly finds no edge, which is the proof it's clean.
- When signal is weak, a simple linear model can beat boosted trees; the train–val overfit gap is how you diagnose it (Logistic Regression won out-of-sample here).
- Problem framing — P(TP before SL) — mattered far more than model choice.
Future Improvements
- Meta-labeling for position sizing
- Purged K-fold cross-validation
- Multi-asset / multi-timeframe training
- Probability calibration wired into the backtest