All strategies · Longbow Learned review page
Version 1.0. Frozen 2026-10-20. Owner: Prashant Maheshwari. Status: forward paper run active (₹20 lakh notional), no real money, no orders.
It is an A/B partner of Longbow Weekly (same data, same costs, same portfolio rules). Read research/weekly/STRATEGY.md first: this document only describes what is different.
The owner asked whether a TensorTrade-inspired approach was worth building. Review result (see section 8): do not adopt the TensorTrade library; borrow its ideas (separate action / reward / exchange components, costs inside the reward), run the work on Nifty 500 weekly data only, in three phases with stop rules fixed in advance: 1. Phase 1: a plain machine-learning stock ranker versus the hand-written Longbow rule. 2. Phase 2: a small reinforcement-learning agent that only sets market exposure. 3. Phase 3: a forward paper run of whatever survives.
Every Friday, a LightGBM model (an ensemble of 8 random seeds, retrained every 26 weeks) estimates for each liquid Nifty 500 stock the probability of being in the top 20% of 4-week forward returns. That probability is turned into a rank, averaged 50/50 with the rank of the Longbow score (risk-adjusted 39-week momentum, skipping 4 weeks), and the top 15 are held with the same rules as Longbow Weekly: monthly rebalance, hold while rank is within 22, cash when the Nifty 500 is below its 26-week average, trades at the next open, delivery costs plus 0.2% slippage a side.
| Item | Longbow Weekly | Longbow Learned |
|---|---|---|
| Score | Longbow score only | 0.5 x rank(LightGBM probability) + 0.5 x rank(Longbow score) |
| Capital (paper) | ₹5,00,000 | ₹20,00,000 |
| Retraining | none | every 26 weeks from the paper start |
| Everything else | identical (universe, N=15, k=4, hold rank 22, filter, costs, execution) |
Stock features (cross-sectional percentile ranks among eligible stocks that week): returns over 1, 2, 4, 8, 13, 26 and 52 weeks; momentum 39-to-4 and 52-to-4 weeks; volatility over 13, 26 and 52 weeks; risk-adjusted momentum (two versions); distance from the 52-week high and the 26-week low; price relative to the 10-, 30- and 40-week averages; ATR as % of price; log traded value; volume relative to its 10-week average; RSI(14); beta to the Nifty 500 and residual volatility (52 weeks). Market-state features (same for all stocks that week): Nifty 500 return over 4, 13 and 26 weeks, whether it is above its 26-week average, its 26-week volatility, and the share of stocks above their 40-week average.
Window: predictions from 2018-01 to 2025-09, capital ₹20 lakh, 2x costs plus 4% a year survivorship haircut (same convention as Longbow). The 2025-10 to 2026-10 period was not used for evaluation (it was spent as Longbow's hold-out); it is used only as training data in the live run.
| Ranker | CAGR | Worst fall | Sharpe |
|---|---|---|---|
| Longbow rule (baseline) | 22.1% | 22.0% | 1.25 |
| Ridge regression | 11.5% | 23.1% | 0.98 |
| LightGBM regression | 16.3% | 27.7% | 1.06 |
| LightGBM top-quintile classifier | 31.6% | 34.6% | 1.45 |
| Ridge + rule blend | 17.4% | 21.0% | 1.19 |
| LightGBM regression + rule blend | 19.7% | 24.7% | 1.21 |
| LightGBM classifier + rule blend (one seed) | 31.4% | 20.7% | 1.56 |
| Chosen: classifier + rule blend, 8-seed ensemble | 30.8% | 19.8% | 1.51 |
Top-quantile threshold x retrain frequency: advantage over the rule between +6.3% and +10.3% a year in all nine cells (CAGR 28.4% to 32.4%; worst fall 19.0% to 21.3%). The result does not hinge on 20%/26 weeks.
Tabular Q-learning agent choosing 0%, 50% or 100% exposure to the stock sleeve each week from market-state buckets and its current exposure; reward = return net of change costs minus a variance penalty; trained walk-forward by year; 20 seeds; OOS 2020-01 to 2025-09. * Always 100% invested: 37.5% a year, worst fall 32.2%. Plain Nifty 500 above 26-week filter: 39.1%, 19.4%. * RL agent (mean of 20 seeds): 16.7%, worst fall 28.1%, average exposure 49%; behind the plain filter in every seed (by 14.6 to 23.2 points a year). Random exposure policies: 2.4%. * Verdict: stopped. With about 300 training weeks, the agent cannot beat a one-line rule. No RL component is used in Longbow Learned.
research/ml/paper_ml.py, cron research/ml/nightly_paper_ml.sh Monday to Friday 19:30 IST (after Longbow Weekly's 19:15 run). Outputs in data/paper/ml_weekly/ (equity.csv, trades.csv, positions.csv, orders_next.csv, signals_latest.csv, events.log, and cached model files in models/).| Risk | Note |
|---|---|
| Selection bias | The classifier blend was the best of 36 distinct combinations; the reality-check p-value is 0.072 |
| Leakage | Controlled by the 5-week embargo and point-in-time features and membership, but any subtle look-ahead would inflate results; replay equals engine in plumbing tests |
| Survivorship | Hurts ML more than a fixed rule: the model learns from survivors; missing delisted names (a third of past members) are not in the training data |
| Regime change | Feature importance is dominated by market-state variables; if market behaviour shifts, relationships can break. Retraining every 26 weeks adapts slowly |
| Overlap with Longbow | Both pick similar stocks; they are not two independent bets |
| Complexity | More moving parts (data, features, models, seeds, caches) means more ways to fail silently. The nightly log must show "trained block" at the right dates |
| Everything in Longbow Weekly's risk table | Applies unchanged |
research/ml/results/portfolios.csv are duplicates.| Path | What |
|---|---|
research/ml/features.py |
Features and labels |
research/ml/run_ml.py, analyze_ml.py |
Phase 1 models, portfolios, tests versus the rule |
research/ml/seeds.py, sens.py, ml_final.py |
Stability, plateau and detailed checks |
research/ml/rl_exposure.py |
Phase 2 reinforcement-learning experiment |
research/ml/paper_ml.py, nightly_paper_ml.sh, paper_spec.json |
Paper run |
research/ml/export.py |
Review-page bundle |
research/ml/results/ |
Result tables |
data/paper/ml_weekly/ |
Paper outputs |
Longbow Learned uses the same audit design as Longbow Weekly: trade log with signal and fill dates, ranks and prices; fills.csv; the automatic checks; one hash-chained, GitHub-committed signal snapshot per decision week (here with the model probability beside each score); the nightly replay check; and the in-browser hash verifier. See research/weekly/STRATEGY.md section 13 for the full description and its limits. The model files are cached per block in data/paper/ml_weekly/models/.
This period was never used to evaluate Longbow Learned (only Longbow Weekly's hold-out was opened on it). It is run once, before the first live model is trained on it (2026-10-23). * Procedure: the same walk-forward procedure as the development tests (retrain every 26 weeks on data up to 5 weeks before the block, 8 seeds, 50/50 blend with the rule), continued through 2026-10-16; no tuning. * Reported at standard costs (paper settings) and at 2x costs plus the 4% a year allowance; the verdict uses 2x costs plus the 4% allowance (the development convention). Both are shown. * Verdict rules over the 55 weeks (total return, ML blend versus the Longbow rule on the same basis): * Pass: ML blend ahead of the rule by at least 3 percentage points and its worst fall under 20%. Confidence rises; the paper run continues as planned. * No reliable difference: within 3 points either way. The paper run continues; expectations stay modest. * Unproven: more than 3 points behind the rule, or worst fall above 25%. The paper run continues at low priority and is not extended. * The result cannot reopen or alter the frozen specification; the period is then spent for this strategy.
| Basis (55 weeks) | ML blend | Longbow rule | ML minus rule | ML worst fall | Rule worst fall |
|---|---|---|---|---|---|
| Standard costs (paper settings) | +5.4% | +5.3% | +0.1 points | 10.1% | 8.0% |
| 2x costs + 4% haircut (verdict basis) | +0.8% | +0.5% | +0.3 points | 12.3% | 10.5% |
Nifty 500 price index over the same weeks: -3.3% (worst fall 13.1%). Rule blended with random numbers: -1.5% on average.
Pre-registered verdict: NO RELIABLE DIFFERENCE (within 3 points of the rule). Both were positive in a down market; the ML blend was not better than the plain rule in this year. Monthly returns at standard costs, ML / rule: Oct 2025 2.6 / 0.5; Nov -0.6 / -0.1; Dec 0.1 / -1.8; Jan -6.2 / -3.7; Feb 0.3 / 0.3; Mar 0.3 / 0.3; Apr 0.4 / 0.4; May 0.3 / 0.3; Jun 0.3 / 0.3; Jul -4.3 / -2.3; Aug 11.1 / 9.3; Sep 1.5 / 1.9; Oct 0.2 / 0.2.
Rebalance-phase sensitivity (analysis only, no rule change): shifting the four-week rebalance cycle by 0, 1, 2 or 3 weeks gave hold-out totals (ML / rule, standard costs) of +5.4 / +5.3, -2.6 / +0.6, +0.8 / +1.5 and -0.2 / -1.4 percent. In the development window (2018 to 2025-09, 2x costs + 4% haircut) the ML blend was ahead of the rule in all four phases (30.8 / 22.2, 29.2 / 20.9, 24.3 / 20.2, 29.8 / 27.5 CAGR). So the hold-out year gave no sign that the ML layer helps, and no sign that it hurts; its development advantage is intact but not reinforced.
What this changes: nothing in the frozen specification. Under the written rules the paper run continues with modest expectations. The period is now spent: from 2026-10-23 the live models train on it. The same one-phase caveat applies to the paper run, which uses a single fixed phase.
Research and education only. Hypothetical and back-tested results have inherent limitations and do not guarantee future results. Not investment advice; the publisher is not presented as a SEBI-registered investment adviser or research analyst.