r/algorithmictrading • • Jan 10 '21

Arbitrage as a Shortest-Path Problem

Thumbnail
skzv.medium.com
22 Upvotes

r/algorithmictrading • • Oct 22 '26

Novice To the ones who’ve succeeded

21 Upvotes

How has your life changed after making your algorithm. I have been wondering how it would be once my algorithm works to the extent that I want it to and how it could genuinely change a lot about my life.

Please let me know and brag a little👍


r/algorithmictrading • • Aug 23 '25

Backtest Need feedback

Post image
21 Upvotes

Hi,

So I have been working on a trading strategy for quite some while now and I finally got it to work. Here are the results of the backtest-

Final strategy value: $22,052,772.57 Total strategy PnL: $21,052,772.57

Buy & Hold final value: $8,474,255.97 Buy & Hold PnL: $7,474,255.97

Max drawdown: 34.92% Sharpe ratio: 1.00

Started with 1 million. Backtested on gold futures.

Could you tell me if this is just too good to be true or if there is actually potential. I don’t plan to completely automate it yet as I want to test it out paper trading first. Could yall recommend any good paper trading sites that I could connect it with to use it with live market data?

I appreciate any guidance.


r/algorithmictrading • • Jul 29 '25

My Algo Trading System

21 Upvotes

I have been developing a naive algo trading system over the past few months. Here is the link to the repository: https://github.com/bhvignesh/trading_system

The repo contains modular (data) collectors, strategies, an optimization framework and database utilities. The README lists the key modules:

1. **Data Collection (`src/collectors/`)**
   - `price_collector.py`: Handles collection of daily market price data
   - `info_collector.py`: Retrieves company information and metadata
   - `statements_collector.py`: Manages collection of financial statements
   - `data_collector.py`: Orchestrates overall data collection with error handling

2. **Strategy Implementation (`src/strategies/`)**
   - Base classes and categories for Value, Momentum, Mean Reversion, Breakout, and Advanced strategies

3. **Optimization Framework (`src/optimizer/`)**
   - `strategy_optimizer.py`: Hyperparameter tuning engine
   - `performance_evaluator.py`, `sensitivity_analyzer.py`, and ticker-level optimization modules

4. **Database Management (`src/database/`)**
   - `config.py`, `engine.py`, `remove_duplicates.py`, and helper utilities

How to Build the Database

main.py loads tickers from data/ticker.xlsx, appends the appropriate suffix for the exchange, then launches the data collection cycle:

tickers = pd.read_excel("data/ticker.xlsx")
tickers["Ticker"] = tickers.apply(add_ticker_suffix, axis=1)
all_tickers = tickers["Ticker"].tolist()
data_collector.main(all_tickers)

Database settings default to a SQLite file under data/trading_system.db:

base_path = Path(__file__).resolve().parent.parent.parent / "data"
database_path = base_path / "trading_system.db"
return DatabaseConfig(
    url=f"sqlite:///{database_path}",
    pool_size=1,
    max_overflow=0
)

Each collector inherits from BaseCollector, which creates system tables (refresh_state, signals, strategy_performance) if they don’t exist:

def _ensure_system_tables(self):
    CREATE TABLE IF NOT EXISTS refresh_state (...)
    CREATE TABLE IF NOT EXISTS signals (...)
    CREATE TABLE IF NOT EXISTS strategy_performance (...)

Running python main.py (from the repo root) will populate this database with daily prices, company info, and financial statements for the tickers in data/ticker.xlsx.

Running Strategies

The strategy classes implement a common generate_signals interface:

def generate_signals(
    ticker: Union[str, List[str]],
    start_date: Optional[str] = None,
    end_date: Optional[str] = None,
    initial_position: int = 0,
    latest_only: bool = False
) -> pd.DataFrame:

Most backtesting runs and optimization examples are stored in the notebooks/ directory (e.g., hyperparameter_tuning_momentum.ipynb and others). These notebooks demonstrate how to instantiate strategies, run the optimizer, and analyze results.

Generating Daily Signals

Strategies can return only the most recent signal when latest_only=True. For example, the pairs trading strategy trims results to a single row:

if latest_only:
    result = result.iloc[-1:].copy()

Calling generate_signals(..., latest_only=True) on a daily schedule allows you to compute and store new signals in the database.

Community Feedback

This project began as part of my job search for a mid-frequency trading role, but I want it to become a useful resource for everyone. I welcome suggestions on mitigating survivorship bias (current data relies on active tickers), ideas for capital allocation optimizers—especially for value-based screens with limited history—and contributions from anyone interested. Feel free to open issues or submit pull requests.

Future State

In the project, I’ve implemented 28 technical indicators and 4 advanced strategies using LLMs. I’ve tuned 25 of those indicators so far, and plan to combine them using a Deep Q-learning network with discounted reward modeling. Additionally, I’ve implemented 16 value-based screeners to help evaluate fundamentals alongside technical signals.

I’m aware that my project currently suffers from survivorship bias, since I’m using data from currently active tickers.

One area I’m still figuring out is how to build an optimizer to allocate capital across strategies — particularly for value-based ones where backtesting data is almost non existent.

Finally, I plan to build an event-driven strategy that incorporates LLMs to process news feeds and generate trading signals — something I’ll begin once I’ve wrapped up the technical-analysis-based components.


r/algorithmictrading • • Jul 01 '22

been algo-trading with 75k account since 2021. beating market but so far, eve tho its down for the year

21 Upvotes

Hi this is my first post on reddit. Wanted to share about my experience doing algo/day trading for the past 1.5 years

  • wrote a bot from scratch using javascript / c / sqlite

  • trades in a basket of 1,400 nasday / nyse / arca listed stocks

    • basket is created thru ML of stocks with good likelihood of being roundtripped within 24 hour period

  • bot trades at near high-frequency in 15 second intervals

  • turnover in my $75,000 account has been $10 million since 2020

  • a typical trading day will make ~400 trades / ~200 roundtrips

    • each trade is on average ~$150

  • a good roundtrip is one that earns +0.25% profit

  • basic strategy is swing trade around an equilibrium line around SPY (combo of vwap / sma / % chg from previous day)

    • when SPY goes below equilibrium line, bot starts buying from basket of stocks

    • when SPY goes above equilibrium line, bot starts liquidating its holdings.


r/algorithmictrading • • Jun 23 '26

Strategy Tested 80+ hypotheses and found absolutely zero alpha. Anyone else hit this brick wall during R&D?

20 Upvotes

Hey everyone,
I’ve been deep in the R&D trenches for a while now, building out my trading infrastructure and backtesting framework. I recently caught a nasty look-ahead leak in one of my primary intraday strategies that I thought was killing it—turns out it was just peeking into the future, and the actual live edge is a flat zero.
Since cleaning up my data pipeline and ensuring everything is 100% causally clean, I have rigorously formulated and tested over 80 distinct hypotheses (ranging from structural market skews, mean reversion variations, and VIX-rebound mechanics to alternative intraday trend-following filters).
The result? Absolutely zero sustainable alpha. Every single one either decays rapidly into noise after transaction costs/slippage or turns out to be complete variance around a zero-edge. The only things that seem hold up to a degree are basic daily structural skews, but intraday alpha feels completely dried up or hidden beneath transaction frictions.
For those who have been doing this full-time or for years:

  1. Did you find your first real edge by significantly increasing complexity, or by finding simpler, overlooked market microstructural inefficiencies?

  2. Appreciate any insights or reality checks. Back to the drawing board for now.

here’s my list of my hypothesis’s;

H1: Intraday momentum: early-session return predicts the last-bar return (session-boundary).
H2: FX time-of-day: a currency is weak during its own local trading hours, USD weak in US hours.
H3: Asian-session conviction predicts a same-direction US-session move (continuation).
H4: Overnight index gaps revert intraday (gap fade).
H5: Crypto over-reaction: large moves mean-revert.
H6: Turn-of-month: long equity indices around month-end (flow effect).
H7: FOMC even-week calendar cycle in equity returns.
H8: Overnight index drift (close-to-open premium).
H10: Gold/Silver ratio mean-reversion (pairs trade).
H11: VIX term-structure as a regime gate for equity exposure.
H12: Intraday FX mean-reversion portfolio (z-fade across majors).
H13: Vol-gated intraday FX mean-reversion (H12 + volatility filter).
H18: COT positioning reversal (fade extreme commercial/spec positioning).
H19: Variance-risk-premium (VIX²−realised vol) equity timing.
H19b: Meta-labelling upgraded the gap-fade into "edge #2" (later superseded).
H23: Oil -> commodity-FX (CAD/NOK) daily lead-lag.
H24: Risk-off FX: SPX stress predicts FX moves.
H25: VIX carry (term-structure roll yield).
H26: Discrete z-score mean-reversion generalised to non-FX assets.
H27: Index opening-range fade.
H28: Diversified 12-month time-series momentum (TSMOM), vol-scaled, across all asset classes.
H29: Cross-sectional 12-1 stock momentum (Jegadeesh-Titman) on ~31 US single-name CFDs.
H30: Crypto time-series momentum (trailing-sign, vol-scaled, monthly).
H31: Commodity time-series momentum (energy/ags/copper, 12m sign, inverse-vol).
H32: Betting-against-beta: long low-beta / short high-beta US large-caps.
H33: Gold+Silver trend-following on deep history (2003–2026, 12-1 TSMOM).
H34: Deep FX time-series momentum (10 majors, 2003–2026).
H35: Currency cross-sectional momentum (3-month rank L/S, 10 majors).
H36: COT commercial-flow acceleration (follow the weekly change in net positioning).
H37: EIA crude-inventory surprise -> oil drift (supply shock).
H38: Wikipedia-attention over-reaction reversal (fade attention spikes).
H39: GDELT global risk-tone shock -> safe-haven (long gold / short US500), 3-day.
H40: Wikipedia-attention continuation/momentum (follow attention spikes).
H41: Diversified cross-asset TSMOM book (~40 instruments, equal-risk).
H42: H41 + a HistGradientBoosting ML meta-label filter.
H43: Metals-trend (H33) + ML meta-label strict-upgrade attempt.
H44: Commodity-trend (H31) + ML meta-label filter.
H45: Currency cross-sectional momentum (H35) + ML meta-label filter.
H46: Crypto weekend effect: short alts / long BTC over the Fri->Mon TradFi-closed window.
H47: COT non-commercial (large-spec) positioning-extreme fade, pooled across 12 markets.
H48: EIA natural-gas storage-surprise reversal on Henry Hub.
H49: Google-Trends fear-search risk-off -> short US indices / long gold next week.
H50: FX cross-sectional value / long-horizon reversal (cheap vs own 5y mean).
H51: GDELT Middle-East conflict-intensity -> two-sided oil geopolitical risk premium.
H52: Wikipedia "OPEC" sustained-attention trend -> directional crude.
H53: EIA gasoline inventory seasonal-surprise -> crude drift (storage theory).
H54: Discrete intraday index mean-reversion (M15, real tick-replay).
H55: Discrete intraday metals mean-reversion (XAU/XAG, M15, real tick-replay).
H56: Cross-index overnight lead-lag (US session -> ex-US index next open).
H57: Intraday breakout + ATR trailing-stop (path-dependent, real tick-replay).
H58: Market-neutral cross-index intraday MR (strips global-risk beta).
H59: Extreme-dislocation selective mean-reversion (few high-conviction trades/day).
H60: Discrete intraday stock mean-reversion (liquid US-stock CFDs, M15).
H61: Intraday-momentum "vol-since-open" breakout (Zarattini, VWAP-trail, EOD-flat).
H62: Ex-US-open FADE of the completed US move (= H56 sign-flipped).
H63: Follow 3-sigma intraday extremes / continuation (= H59 sign-flipped).
H64: Crypto weekend volume-conditioned reversal.
H65: Wikipedia attention-capitulation fade.
H66: Overnight-premium (night effect) momentum.
H67: Copper supply-chain "chemical" lead-lag.
H68: GDELT media emotion-intensity signal.
H69: Cross-asset synchronized attention.
H70: Break-and-retest continuation at a multi-day support/resistance level.
H71: Scheduled macro-event volatility-expansion continuation (NFP + FOMC).
H72: Prior-day high/low liquidity-sweep reversal (failed-break fade).
H73: Follow a large/coordinated G10 central-bank FX intervention (USDJPY) — the campaign's one confirmed event-edge.
H74: Month-end pension rebalancing -> directional equity-index pressure (last 4 days).
H75: FX big-figure stop-loss cascade continuation (Osler).
H76: Index quad-witching expiration-distortion reversal.
H77: WTI EIA-day intraday momentum (3rd half-hour predicts the last half-hour).
H78: BTC/ETH macro-event (FOMC/CPI) spike-and-reverse intraday.
H79: Post-announcement bad-news next-day drift (equity-index under-reaction).
H80: FX WM/R 16:00 London-fix W-pattern reversal.
H81: Gold LBMA fix (10:30 / 15:00 London) run-up-and-fade.
H82: Gold real-yield regime breakout (TIPS-gated).
H83: Natural-gas storage-deviation seasonal long/short.
H84: FX carry-unwind crash continuation (JPY crosses, VIX-gated.)


r/algorithmictrading • • Dec 24 '25

Strategy Using LLMs as a risk filter, not an alpha model

20 Upvotes

I’ve been testing LLMs outside the signal-generation loop and getting better results than trying to make them predict prices.

Setup:

  • Signals from traditional models (momentum + volatility regime filters)

  • Execution and sizing are fully rule-based

  • LLM sits pre-trade as a sanity check

I use it to:

  • Stress-test trade assumptions

  • Surface bias (recency, confirmation)

  • Flag regime mismatch or hidden news risk

I don’t use it for:

  • Price prediction

  • Entries/exits

  • Parameter tuning

Backtests didn’t boost raw returns much, but drawdowns improved, especially during regime shifts. Fewer low-quality trades.

Anyone using LLMs in a similar risk / validation layer rather than chasing alpha?


r/algorithmictrading • • Sep 30 '25

Strategy [Project] Open-source stock screener: LLM reads 10-Ks, fixes EV, does SOTP, and outputs BUY/SELL/UNCERTAIN

20 Upvotes

TL;DR: I open-sourced a CLI that mixes classic fundamentals with LLM-assisted 10-K parsing. It pulls Yahoo data, adjusts EV by debt-like items found in the 10-K, values insurers by "float," does SOTP from operating segments, and votes BUY/SELL/UNCERTAIN via quartiles across peer groups.

What it does

  • Fetches core metrics (Forward P/E, P/FCF, EV/EBITDA; EV sanity-checked or recomputed).

  • Parses the latest 10-K (edgartools + LLM) to extract debt-like adjustments (e.g., leases) -> fair-value EV.

  • Insurance only: extracts float (unpaid losses, unearned premiums, etc.) and compares Float/EV vs sub-sector peers.

  • SOTP: builds a segment table (ASC 280), maps segments to peer buckets, applies median EV/EBIT (fallback: EV/EBITDA×1.25, EV/S≈1 for loss-makers), sums implied EV -> premium/discount.

  • Votes per metric -> per group -> overall BUY/SELL/UNCERTAIN.

Example run

pip install ai-asset-screener
ai-asset-screener --ticker=ADBE --group=BIG_TECH_CORE --use-cache

If a ticker is in one group only, you can omit --group.

An example of the script running on the ADBE ticker:

LLM_OPENAI_API_KEY not set - you work with local OpenAI-compatible API

================================================================================
GROUP: BIG_TECH_CORE
================================================================================
Tickers (11): AAPL, MSFT, GOOGL, AMZN, META, NVDA, TSLA, AVGO, ORCL, ADBE, CRM
The stock in question: ADBE

...

VOTE BY METRICS:
- Forward P/E -> Signal: BUY
  Reason: Forward P/E ADBE = 17.49; Q1=29.69, Median=35.27, Q3=42.98. Rule IQR => <Q1=BUY, >Q3=SELL, else UNCERTAIN.
- P/FCF -> Signal: BUY
  Reason: P/FCF ADBE = 15.72; Q1=39.42, Median=53.42, Q3=63.37. Rule IQR => <Q1=BUY, >Q3=SELL, else UNCERTAIN.
- EV/EBITDA -> Signal: BUY
  Reason: EV/EBITDA ADBE = 15.86; Q1=18.55, Median=25.48, Q3=41.12. Rule IQR => <Q1=BUY, >Q3=SELL, else UNCERTAIN.
- SOTP -> Signal: UNCERTAIN
  Reason: No SOTP numeric rating (or segment table not recognized).

GROUP SCORE:
BUY: 3 | SELL: 0 | UNCERTAIN: 1

GROUP TOTAL:
Signal: BUY

--------------------------------------------------------------------------------

================================================================================
SUMMARY TABLE BY GROUPS (sector account)
================================================================================

Group                        | BUY    | SELL     | UNCERTAIN        | Group summary
---------------------------- | ------ | -------- | ---------------- | --------------
BIG_TECH_CORE                | 3      | 0        | 1                | BUY

TOTAL SCORE FOR ALL RELEVANT GROUPS (by metrics):
BUY: 3 | SELL: 0 | UNCERTAIN: 1

TOTAL FINAL DECISION:
Signal: BUY

LLM config Use a local OpenAI-compatible endpoint or the OpenAI API:

# local / self-hosted
LLM_ENDPOINT="http://localhost:1234/v1"
LLM_MODEL="openai/gpt-oss-20b"

# or OpenAI
LLM_OPENAI_API_KEY="..."

Perf: on an RTX 4070 Ti SUPER 16 GB, large peer groups typically take 1–3h.

Roadmap (vote what you want first)

  • Next: P/B (banks/ins), P/S (low-profit/early), PEG/PEGY, Rule of 40 (SaaS), EV/S ÷ growth, catalysts (buybacks/spin-offs).

  • Then: DCF (FCFF/FCFE), Reverse DCF, Residual Income/EVA, banks: Excess ROE vs TBV.

  • Advanced: scenario DCF + weights, Monte Carlo on drivers, real options, CFROI/HOLT, bottom-up beta/WACC by segment, multifactor COE, cohort DCF/LTV:CAC, rNPV (pharma), O&G NPV10, M&A precedents, option-implied.

Code & license: MIT. Search GitHub for "ai-asset-screener".

Not investment advice. I’d love feedback on design, speed, and what to build next.


r/algorithmictrading • • Jul 29 '25

Is Quantitative Trading Realistically Achievable Without a PhD or Strong Math Background?

20 Upvotes

Hi everyone,

I'm on a serious journey to become a quantitative trader. I’m not here to chase shortcuts or quick wins — I genuinely want to build statistically sound, research-based strategies driven by math and data.

But I’m struggling with some tough questions…

I have zero math background — I’m literally learning 3rd grade math right now.

I don’t have a degree from a strong university, no access to top mentors, no funding.

I study alone, trying to learn Python, Pandas, Plotly, and now starting on algebra slowly.

I feel like to truly build strong strategies, you need to be a PhD-level researcher.

I fear I’ll spend 2–4 years just to realize the field isn’t realistic for someone like me.

Can one person really do all this? Be the researcher, developer, and trader without any support?
Or is this path only viable for people inside hedge funds and elite academic backgrounds?

If you’ve made it as a self-taught quant or even partially succeeded — please share your story.
How long did it take you to start seeing results?
What did you wish you knew earlier?

Thanks for your honesty. 🙏


r/algorithmictrading • • Feb 19 '21

Debugging my new algo program. It’s running live buying a single share to test. And look, why did it buy that? Stop. Rinse. Repeat.

20 Upvotes

r/algorithmictrading • • Apr 06 '20

Award-Winning Framework for Backtest Overfitting + Implementation.

Thumbnail
github.com
20 Upvotes

r/algorithmictrading • • Jan 16 '20

experienced prop trader details his custom Python algo trading setup

Thumbnail
fxgears.com
20 Upvotes

r/algorithmictrading • • Sep 07 '26

Question How did you get started with profitable algorithmic trading?

19 Upvotes

Hey everyone,

I currently have a trading strategy that I believe has potential to be profitable, but it still has some flaws that I’m working on. I’m building a daily stock trading bot to implement the strategy properly, the way I have it in my head, and hopefully improve and optimize it over time.

For those of you who eventually managed to become consistently profitable with automated/algo trading:

How did you start your journey? What steps did you go through? And roughly how long did it take you to become profitable?

So far, I’ve set up my scanner, entry/exit conditions, and rules, and I’ve started testing it with real data/trades. I’m getting some results, but they’re still nowhere near reliable enough to trust.

Right now, I’m mainly focused on collecting a large amount of data — trades, conditions, numbers, outcomes, and as many details as possible — so I can analyze everything using probability and statistics. My goal is to find as many real patterns and insights as possible, calibrate the strategy properly, and figure out what actually brings me closer to profitability instead of just relying on assumptions.

Do you think this approach is useful, or am I potentially overthinking it and wasting time?

Did you guys go through a similar process, or did you approach it in a completely different way?

Also, what tools did you use along the way? Are there any tools, methods, books, platforms, or resources you would recommend?

Any advice on how to get closer to the truth, avoid wasting time, and speed up the learning process would be greatly appreciated.

Thanks in advance to everyone who takes the time to share their experience!


r/algorithmictrading • • Sep 08 '25

Backtest Update: Ensemble Strategy (29/20)

Post image
19 Upvotes

Just follow-up to the (33/20) equity curve I posted recently: Same strategy - uses a small ensemble of single-parm component models, GA-optimized using MC regularization. Unlike the previous run, this EC is not in-sample and came in at (29% CAGR / 20% maxDD) over the 25-year test period. Still subject to some survivorship bias, so calibrate expectations accordingly.


r/algorithmictrading • • Jul 22 '21

What exactly does a 'quantitative trader' do at a HFT/Market Making Firm?

19 Upvotes

I am pretty confused about what a quant trader does at HFT firms like citadel securities, optiver, IMC.

From my understanding HFT is mostly based around fast code execution and occurs at the speed of micoseconds. So then what in particular does a quant trader do? Do they monitor life performance? Check for problems?


r/algorithmictrading • • Jun 02 '26

Strategy 5 gates I run before risking capital on a strategy, ranked by how cheaply each one rejects

18 Upvotes

How I decide if a strategy is live-ready: the 4 gate process that killed 37 of my last 41 strategies

TLDR: I run every strategy through 4 gates in cost order, cheapest rejection first. Economic hypothesis, sample size floor, three statistical tests and cost and regime stress test. Of 41 strategies I logged last year, only 4 reached live capital. The process is built to kill, not to bless a system.

Why run a fixed process instead of judging each strategy on its merits?

Discretion is where overfitting hides. If you evaluate each strategy by looking at it, you will find a reason to trade the ones you are attached to.... A fixed sequence removes it. Every candidate faces the same gates in the same order, and the order is deliberate: cheapest disqualifier first, so most strategies die before I spend hours on walk-forward.

Last year I logged 41 strategies through this. Gate 1 killed 12. Gate 2 killed 9. Gate 3 killed 14. Gate 4 killed 2. 4 survived to live capital.

Here is the catch... The 37 that died had a median in sample Sharpe of 2.1. The 4 that survived had a median of 1.4. The strategies that looked best on paper were the ones this exact process rejected.

Gate 1: Is there an economic reason the edge should exist?

This gate has no code, and that is the point. Before any test, I write one paragraph naming why the inefficiency exists, who is on the other side of the trade, and why they keep losing. A liquidity premium... A structural hedger who trades regardless of price... A behavioral bias with real flow behind it.

If I can't name the loser, I do not test the strategy. A pattern with no mechanism is a pattern you found by looking, which means you will find one.

This is the cheapest gate and it rejects the most garbage. 12 of my 41 never cleared it. They were useless systems dressed up as ideas. Most people skip this gate because it is the only one you cannot automate, which is exactly why it filters what the automated gates can't.

Gate 2: Does the backtest have enough data to mean anything?

This gate asks one thing. Do you have enough data to tell skill from luck?

First, enough trades. A backtest with 80 trades swings too much to trust. I want at least 400 before I believe any metric.

Second, a long enough time period. When you test many versions of a strategy and keep the best one, that winner looks good partly by chance, the way the luckiest player in a coin flipping contest looks skilled. Ruling that out takes years of data, and how many years depends on how many versions you tried. After testing around a hundred versions, a 1.0 Sharpe needs about six years of data before you can trust it. A flashy 2.0 Sharpe needs only about two. A high score on a short backtest is the most dangerous thing in a research log, because luck fakes it easily.

9 strategies died here. A 1.3 Sharpe on 14 months is not an edge. It is a sample too small to tell.

It's not that low Sharpe needs more testing because it's weaker. It needs more testing because it's closer to the level random chance can imitate.

Gate 3: Does it survive the three overfitting tests?

This is the expensive gate, so it runs third, only on survivors. 3 tests, each catching a different failure, run cheapest first.

Deflated Sharpe Ratio first, because it is one calculation. A normal Sharpe assumes you only tried one strategy. But if you tested 80 versions and kept the best, that winner is partly lucky, and the plain Sharpe has no idea you ran 80 attempts. The Deflated Sharpe fixes that. It takes your reported Sharpe, accounts for how many versions you tried, and adjusts for fat tails and lopsided returns, then hands back a single probability: the chance your edge is real rather than the luckiest of your tries. Same enemy as Gate 2, caught at a different step. My cutoff is 95%. If the best of your 80 versions scores only 60%, that still leaves a 40% chance the edge is imaginary, so it never reaches my account.

Monte Carlo is next. Resample the trade sequence 10,000 times and read the 95th percentile of max drawdown. Your backtest shows one drawdown, but that is just the order your trades happened to land in. If the drawdown in your 95th percentile drawdown is more than your account can take, it doesn't pass

Walk-forward last, because it is a full reoptimization. 5y build, 1y test, rolled forward. Profit factor holds above 1.3 on at least 7 of 10 out of sample windows or it dies. Fourteen strategies died at this gate, most on the deflated Sharpe before walk forward ever ran.

14 systems died here.

Gate 4: Does the edge survive real costs and a regime split?

A clean backtest assumes free, instant fills. I model realistic costs first, then stress them: triple my real commissions, add a tick of slippage, re-run.

The metric I watch is not profit factor, it is expectancy and Sortino retention. The edge has to keep at least 70% of its expected value after the stressed costs. A real edge degrades gracefully. A fake one inverts the moment friction touches it.

Then I split the history by volatility regime and require profit factor above 1 in both the calm and the stressed halves.

2 strategies died here.

Bottom line

4 gates, cheapest rejection first.

The process is designed to reject, and last year it rejected 37 of 41. The survivors looked worse on paper than most of the strategies it killed, which is exactly why I trust them.

This is for systematic traders deciding whether a backtest deserves live capital. It applies to single strategies, parameter sweeps, and machine learning models trained on price data.

Updated June 2026


r/algorithmictrading • • May 21 '26

Backtest Built an extreme reversal algo for MNQ/NQ — 4.5 years of backtested data and test results for this week, 7,157 trades, here's everything

Thumbnail
gallery
18 Upvotes

Built an extreme reversal algo for MNQ/NQ — 4.5 years of backtested data and test results for this week, 7,157 trades, here's everything


r/algorithmictrading • • May 01 '26

Question ML Model Is Inconsistent: Good and Bad

Thumbnail
gallery
18 Upvotes

For the last couple of months I have been tinkering with an ML model that predicts certain (relatively rare) events of BTC price movements. Recently, I got some results that are sometimes good and sometimes terrible. I have a few ideas on what experiments could improve performance, but I don't really understand the underlying cause of the problem. Hopefully someone had a similar experience once and can give me some tips.

More details:

I am using mostly 1-second granularity data of prices, trades, and some other metrics of BTC.

As a validation scheme, I am using rolling windows for now with a block of 500,000 rows as training and 86,400 rows as validation, mirroring an actual live use. Train size was chosen based on some small experiments with autocorrelation (nothing sophisticated).

Currently, I am evaluating my feature selection and model-building process as a whole, not a particular model or fixed feature set. For this I plan to use around 10 to 20 folds. In the following, I am showing 4 folds that illustrate what is going right and wrong. Dates (validation data ends at 23:59:59 on these dates) = 2026-04-28, 2026-02-28, 2025-11-28, 2025-07-28. The month offsets are a bit arbitrary but lean to more recent data: [0, 2, 5, 9].

Based on early experiments using other data (not the validation folds), I have found embedded feature selection using only train data to work well sometimes when combined with a large amount of candidate features. From my perspective, it seems that the selection process can find features with predictive power sometimes. Other times the model cannot beat 40% precision.

For now I am using XGB as a classifier with mostly basic parameters: I only quickly tuned the max_depth on some other data apart from the validation folds and set it to 10. The XGB predictions are also ensembled across 30 seeds to stabilize the PNL, as I found it was unstable using just one random seed.

The chosen feature sets, using only the recent training data, and models are evaluated on the validation fold using a set fee logic. The simulated trades don't use any position sizing yet, just a fixed amount per trade ($150). This is why there can be large negative results. When it works, the positions often get opened in quick succession (concurrency of up to 20 positions).

Here's a snapshot of using the prediction threshold 0.8 performance of the out of sample, unseen validation folds:

thresholdnn_tpn_fpprecisionedge_per_tradetotal_net_pnl
f64i64i64i64f64f64f64
0.89870280.71428622.7798972232.42992
0.85971924050.321608-39.229474-23419.995954
0.85582173410.388889-15.50954-8654.323338
0.80000.00.00.0

Using no feature engineering the PNL is negative on that first fold.

Per fold plots:

img

img

img

img

img

Some of my ideas of what I could do without knowing the core underlying problem:

- Regime or per-trade filter
- Use more data for training
- Use feature stability when selecting features

What should I consider doing next?

Thanks in advance.


r/algorithmictrading • • Apr 13 '26

Question When do you give up on trying to crack the code?

18 Upvotes

Edit for context: I’m a software engineer with 10 years+ and I still do this alongside my full-time job. I’m not coming at this blindly or from desperation, which is why it’s been so frustrating.

I’ve been on this algotrading journey for years now, and I honestly do not know at what point you are supposed to stop.

You put in countless hours, and those hours turn into months, then years. You think you are finally getting close, and then you uncover another issue. Overfitting. A bug in the code. A variable not being read properly. Logic that looked solid until you realized it was flawed the whole time.

That is what makes this so mentally exhausting. It is not total failure. It is being almost there again and again.

What makes it harder is that I genuinely feel like I understand the market more now. I see patterns more clearly. I think about it mathematically. I have built detailed frameworks and observations that feel real and hard-earned. So it is not like I am blindly chasing something with no progress. In many ways, I feel closer than ever.

But then reality humbles you again.

One of the biggest things I have realized is that entries are not the whole game. Exits and risk management can make or break everything. You can have a high win rate and still have a bad strategy if your exits are wrong. One weak piece of management can erase so many good decisions. That realization alone made me question how much time I spent focusing on the wrong things.

And I keep thinking about the time cost of all of this. All the nights coding, testing, debugging, re-running, analyzing. All the time I could have spent being present with family, living more, worrying less. It starts to weigh on you in a way that people outside of this probably do not understand.

I guess I’m asking the people who have been deep in this for a long time:

How do you know when to keep going and when to walk away?

How do you deal with the emotional weight of spending years trying to build something that always feels one fix away from working?

And for the people who actually did crack the code after years of struggle, what kept you going long enough to get there? Did you always know you were close, or did it only make sense in hindsight?

I really want to hear from people who have lived this, because this journey can feel very isolating. Thank you all.


r/algorithmictrading • • Apr 10 '26

Backtest Second Algo

Thumbnail
gallery
18 Upvotes

MBv5 is a fully automated, systematic momentum breakout strategy trading MNQ (Nasdaq micro) and MGC (Gold micro)futures on prop firm accounts. The strategy identifies institutional level breaks on 15-minute bars, confirms with 5-minute entry signals, and executes tiered exits across TP1, TP2, and a trailing runner. Every parameter has been validated out-of-sample, stress tested for slippage, and confirmed by independent Monte Carlo analysis. The system is fully automated with zero discretionary intervention required.For informational purposes only. Past performance is not indicative of future results.

Results are based off of a 50k starting balance, $500 risk per trade.

My Sharpe is low because QuantAnalyzer calculates Sharpe on daily P&L, and most days my strategy has zero trades. All those $0 days drag the average down and inflate the standard deviation relative to the mean

Any feedback would be greatly appreciated


r/algorithmictrading • • Feb 10 '26

Educational Why people with quant experience still work for someone?

18 Upvotes

I just want to understand what's stopping quant trader who already have $300k-$500k work for someone else instead of making their own money work for them. May be move low cost country for a year or two if your strategy is making 100-200%.

Enlighten me please.


r/algorithmictrading • • Dec 18 '24

Is there anyone making any money?

18 Upvotes

I have seen lots of posts in here most of are kind of pet project success stories and looking for advices . Is there anyone making legit money out of algorithmic trading except doing it as a hobby or to learn AI


r/algorithmictrading • • Feb 22 '21

Emiliano Fraticelli, computer science teacher by day and the winner of Quantopian fund competition & votery.net week 2 trial by night run shares some investment strategy tips and talks about his passions - quantitative finance and making money online by creating successful trading algorithms

Thumbnail
youtube.com
18 Upvotes