r/mltraders • • 1h ago

An AI written backtest can only cheat with hindsight if the model touches the candles while the test runs

1 Upvotes

The most common doubt I get about using an LLM to backtest is that the model already knows what happened. It was trained on data that includes 2024, so how can a 2024 backtest mean anything?

That worry is real when the model is making the trade decisions during the test. If you hand it each candle and ask buy or sell, it can lean on what it remembers about that week, and nothing in the output will tell you it did.

It goes away when the model only writes the rules. In Agenticks the model turns what you typed into fixed entry, exit and sizing rules as code, and then a separate replay walks the historical candles one at a time with the rules already frozen. The model never sees a candle during the run, so its training cutoff has nothing to leak into.

The place hindsight can still sneak in is the human, which is the part people skip. If you run it, look at the equity curve, change the stop, run it again, and keep going until 2024 looks good, you have done the overfitting yourself and the model was never involved. A strategy that took 15 tweaks to look good on one window has mostly learned that window.

What I check before trusting a run is whether the rules would read the same if I had written them down before seeing any result, and whether the numbers hold on a stretch of data I didnt touch while tweaking, since that second window is the closest thing to live a backtest gets.


r/mltraders • • 2h ago

ScientificPaper Backtested 108 VIX threshold rules for timing VTI against monthly DCA. The winner beat DCA out of sample, and I still don't believe it. Poke holes in this.

0 Upvotes

I tested whether VIX levels can time entries and exits in VTI, with a development/holdout split, explicit dividends and tax lots. Looking for criticism of the methodology.

Setup

- Dec 2016 to Nov 2026, daily data (VTI from Yahoo, VIX from Cboe, 3-month Treasury yield from FRED for idle cash)

- $2,083.33 contributed on the first trading day of each month ($250k total), Roth IRA first up to the annual limit, the rest to a taxable account

- Rule: buy everything when VIX closes at or above X, sell everything when it closes at or below Y, executed at the next day's close

- Grid: buy 20/25/28/30/35/40, sell 12/15/18/20/25, 1- or 2-day confirmation, optional 200-day SMA filter. 108 rules.

- Ranked on Dec 2016 to Dec 2021, then run unchanged on Jan 2022 to Nov 2026

- Dividends paid on ex-date and reinvested, tax lots tracked individually (15% dividends and long-term gains, 24% short-term gains and interest), no commissions or slippage

Result

The top rule in development was buy at VIX >= 30, sell at VIX <= 12.

| | Monthly DCA | VIX 30/12 |

|---|---|---|

| Ending value (after tax) | $515,925 | $546,432 |

| TWR, full period | 13.98% | 14.58% |

| TWR, holdout | 9.90% | 10.47% |

| Max drawdown | -35.0% | -29.5% |

| Trades | 0 | 7 |

| Days invested | 100% | 78% |

Why I don't trust it

  1. The whole edge comes from three exits: mid-2018 (VTI fell 15.3% while out), Nov 2019 to Feb 2020 (fell 5.5%), and May to Aug 2024 (fell 1.5%).
  2. The holdout edge is one round trip. VIX closed at or below 12 on only four days in the entire holdout, with a low of 11.86. A sell threshold of 11.8 produces zero holdout trades and a return identical to DCA.
  3. It's the best of 108. Only 8 rules beat DCA in development. In the holdout, 23 beat it, 12 tied (no trades) and 73 lost. The median rule ended at $403,420 with a 7.55% holdout TWR.
  4. It's fragile. Adding a second confirmation day to 30/12 drops it to $524,215. None of the 54 rules with the SMA filter beat DCA.
  5. The rule sat in cash for the first 14 months and missed a 24.8% rally. That only looks harmless because the balance was tiny.

Two other things I checked

- Buy-only version (hold back 25/50/100% of each contribution, deploy when VIX hits 20/25/30/35, never sell): all 12 variants lost to DCA, by $861 to $14,958.

- Dividends are not what separates the strategies. The 30/12 rule gave up $907 in dividends and earned $4,963 in cash interest. Capital-gains tax is the real drag ($11,059), cutting the pre-tax edge from about $51k to $30.5k.

What I'd like feedback on

- Is there any sensible way to assess a rule with three exits in ten years, or is this simply untestable on this sample?

- Better validation design than one split? I'm thinking walk-forward on VIX history back to 1990 with a different total-market proxy.

- Anything wrong with next-day-close execution or ex-date dividend reinvestment that would bias this?


r/mltraders • • 8h ago

Tutorial Your forex model might be using employment numbers nobody knew at the time

24 Upvotes

A surprisingly easy mistake when building macro features is downloading historical economic data and assuming those were the figures traders originally saw.

FRED generally provides the latest available revisions.

ALFRED lets you retrieve earlier versions of those same economic series.

Imagine a US employment report initially shows 180,000 new jobs, then gets revised to 120,000 a month later.

Those figures are hypothetical but the problem is real.

If a model training on EURUSD reactions uses the revised 120,000 figure as though it was available on the original release morning, it's learning from information that arrived later.

The EURUSD movement visible on moon .com would reflect the market's reaction to information available at the time, not the revised number.

Even a perfectly chronological train and test split won't fix that.

I'd store the original release timestamp and the data vintage alongside every macro observation.

Otherwise a model can end up predicting reactions using numbers the actual market never had.

Pretty nasty source of false accuracy when you're testing news driven strategies."


r/mltraders • • 8h ago

What should an AI trading system learn from a losing trade?

1 Upvotes

I’m building Indomitable, and one of the hardest questions comes after a loss. Looking back, it’s usually easy to spot a reason to wait. But could the system have seen that reason before it bought?

That’s what I’m working on. Indomitable records what it knew when it made a decision. After the market closes, it can revisit that decision and test a possible lesson against later trades. What I want to see is whether that lesson helps it make a better choice the next time.

Here’s a short look inside the app. If you could open up one trade and ask Indomitable to explain one thing, what would you ask? indomitableglobal.com


r/mltraders • • 9h ago

Suggestion How To Build a Prediction Market Trading Bot: Kalshi, Polymarket US, Novig and ProphetX

Thumbnail reddit.com
1 Upvotes

r/mltraders • • 12h ago

recommendation for trading bots

Thumbnail reddit.com
1 Upvotes

Hey, does anyone have experience with a good trading bot that made a good return?


r/mltraders • • 13h ago

Are there people manage multiple algo strategies across different F&O segments(stocks, index, commodities & for scalp, intraday, swing, positional & hedging) and market regimes (like high & low volatility, different even, bear & bull market etc)?

Thumbnail reddit.com
1 Upvotes

r/mltraders • • 15h ago

New to the group

2 Upvotes

Hi everyone. I hope you’re all doing well.
I’ve personally been trading the last 7 years. But for the last 6 months I’ve been building my own forex platform, which acts as a sandbox for walking forward strategies. And monitoring them.
Recently, I got into utilizing game theory, as well as machine learning. I’m using clause to help me through it.
Does anyone have any tips, advice, articles/books I can feed Claude to obtain the best results?


r/mltraders • • 1d ago

Three longs in two choppy days, and why I would have skipped every one by feel

Post image
1 Upvotes

Something I keep relearning after 20+ years of technical analysis and automated trading: the trades that pay are often the ones my eyes would have talked me out of.

MES the last two days was ugly. Sunday night and Monday chopped up and down in a range, Monday afternoon flushed, and overnight Monday into today gave back a big chunk before running again. If you were watching it bar by bar, every push looked like a trap.

I run a rule-based trend system on a sim account. It took three longs in that stretch:

  • Sun night, 7:56 PM ET, long 7,349.25: closed +11.88 pts per contract
  • Mon, 1:04 PM ET, long 7,370.00: closed +6.50 pts
  • Mon, 9:56 PM ET, long 7,377.00: closed today +15.12 pts

Honestly, I would have skipped at least two of them by feel. The Monday 1 PM entry came right after a selloff, and the 9:56 PM entry was in the middle of the overnight session when nothing looked clean. The system did not care how it looked. It checked the same conditions it checks every bar: is the trend aligned across timeframes, is momentum above its threshold, is volatility in a tradable range, is it in a cooldown after a loss. When enough of them agree, it takes the trade and its stop is in at the same time.

To be fair, it is not magic: over the last 30 days the same rules hit a drawdown of about 94 points per contract before recovering. The point is not that it wins. The point is that the decision is the same at 1 PM and at 10 PM, after a win or after a loss, and that is the part I could never do by hand.

Curious how others handle the overnight session. Do you just not trade it, or do you have rules that hold up there?


r/mltraders • • 1d ago

How do you check your model isn't just riding one regime?

1 Upvotes

Something I keep worrying about with ML models on price data... a model can look fine on a test period that happened to be one long trend, and then the market changes and it's a different story.

So how do you deal with it?

  • Do you split your test periods by regime (trending, choppy, high volatility) and look at each one separately?
  • Do you add regime features, or train separate models?
  • How do you even label a regime without looking ahead?
  • Have you dropped a model because it only worked in one kind of market?

Not after a perfect answer, just curious how people actually handle this. Thanks in advance.


r/mltraders • • 1d ago

Working on a project Want Your guidance

Post image
1 Upvotes

Flowtell is a warning system for toxic order flow. It watches the perpetual and spot markets together. When aggressive buying or selling starts on the perp, it estimates within microseconds how likely that flow is to hit the spot market next and move the price. It turns this into a toxicity score (τ), and into quotes that step aside before they get picked off.
How can I make it more better


r/mltraders • • 1d ago

Open Source Python SDK for AI + Algo trading platform

Thumbnail
gallery
0 Upvotes

Hey everyone,

We have been developing this platform because we personally felt the need for a platform that lets you automate your ideas within seconds without any additional engineering effort or setup. A lot of people asked me, 'Why don't you open source it? 'Here it is...

We are open sourcing the while25 Python SDK with which you can actually design your algos, indicators, custom dashboards and AI monitors. A kind of trading application you can think of could be made inside while25 using the SDK.

You can download platform from: https://while25.com

Features

Charts (with custom and pre-built indicators)

Order Management System (to maintain brackets/iceberg and some other order types)

Risk Management System (for prop traders to maintain their session loss limits)

Data Feeds (the market feed comes from the broker you log in with, and other alternative feeds are plugged in to the Python workspace, which you can access for free without any engineering)

AI (the inbuilt AI assistant can look at your complete workspace, including portfolio, charts, indicators, order book, research you are doing, data feeds, news, etc., and can also write code for you using the Python SDK to make strategies, backtests, dashboards, indicators, etc.)

Python SDK (while25 supports a Python-based strategy, backtesting, and indicators: you can plot on a chart, dashboards, like market heat maps or portfolio analysis, etc.)

One can automate any idea in any market they trade in just a minute. You can trade in any asset class, like crypto, equity, options, futures, commodities, etc.

We are looking for genuine feedback from people. As we already have some users, we would love to have
Traders try out this with paper or live accounts to make it better for good.

Supported Brokers: Alpaca, IBKR, Coinbase, Binance, Zerodha, Upstox (coming more in the near term, including dealer feeds like Rithmic)

SDK: https://github.com/Aayush2504/while25-sdk

Install command: pip install while25

Note: The platform already gets the SDK built in; you don't have to download it separately.


r/mltraders • • 1d ago

how can i improve my algo breakout strategy on mgc?

Thumbnail
reddit.com
1 Upvotes

r/mltraders • • 2d ago

How to Screen for High-Volume Options Contracts in Under 50 Lines of Code

Thumbnail
steadyapi.com
1 Upvotes

r/mltraders • • 2d ago

Would you use a platform like this for algo trading

1 Upvotes

I’m a co-founder of Maple Research. We’re currently building a platform that brings a wide range of quantitative research, backtesting, strategy development and validation tools together in one place.
We’re getting closer to launching our MVP, and I’m curious to hear what people in the algo trading community think of the idea.
Is this something you would actually use?
What would it need to offer for you to consider using it?
What do you feel is missing from existing platforms?
Not trying to sell anything here, just genuinely interested in hearing people’s opinions, good or bad.

Mapleresearch.ca

https://x.com/maple_research?s=11


r/mltraders • • 3d ago

Self-Promotion Results after 6 days of live trading.

Post image
3 Upvotes

r/mltraders • • 3d ago

Free dataset: hourly order flow, spread, depth and impact metrics for crypto and tokenised stock perps (Binance, OKX, Hyperliquid), Q3 2026

Thumbnail
huggingface.co
2 Upvotes

Disclosure first: I co-founded Aperiodic, a market data company, and this is one quarter of our data, free on Hugging Face.

What's in it:

- Hourly bars for Q3 2026 (July to September)

- 37 perpetual contracts on Binance, OKX and Hyperliquid: BTC, ETH, SOL and ten real-world asset perps (Tesla, Nvidia, gold, silver, oil, the S&P 500 and others)

- 21 datasets, 226 metric columns, about 1.6M rows: taker order flow split by trade size, spread and order book depth, slippage, price impact, funding, basis, open interest and more

Each metric is computed point in time from the exchange's own trades and quotes, so a bar never uses anything printed after it closed.

Access is one short form on the page, then it's Parquet you can read with `datasets`, pandas or Polars. Some datasets have gaps, mostly order book data in August, and the page lists every one.

https://huggingface.co/datasets/aperiodic-io/crypto-perp-microstructure-q3-2026

Happy to answer questions about how any of the metrics are built.


r/mltraders • • 3d ago

Built an honest labeled crypto research dataset

1 Upvotes

I spent 10 months building a labeled crypto research dataset and I'm giving away the sample. Every candle of 23 pairs × 4 TFs scored + labeled with realized TP/SL outcomes under fixed rules. I publish the calibration numbers even though they're unflattering (skill −0.29 as probability; weak-but-real ranking AUC 0.518). Sample (BTC 1h 2020, full schema): https://huggingface.co/datasets/crucible-data/valkyrie-confluence-sample. If you backtest, I'd genuinely like to know what you find — the data is the point, not a pitch.


r/mltraders • • 3d ago

Request AI Trading Bot

Thumbnail reddit.com
1 Upvotes

r/mltraders • • 4d ago

Simulação de US$ 1.000 em 200 negociações com uma vantagem idêntica de 60/40 em quatro tamanhos de posição (5%, Meio-Kelly, Kelly Completo, 45%) — um lembrete visual de quão brutal é o arrasto da volatilidade além de 2f*.

Thumbnail
reddit.com
1 Upvotes

r/mltraders • • 4d ago

Simulated $1,000 across 200 trades on an identical 60/40 edge at four position sizes (5%, Half-Kelly, Full Kelly, 45%) — a visual reminder of how brutal volatility drag gets past 2f*

0 Upvotes

Everyone knows the textbook Kelly formula f* = (bp - q) / b, yet seeing the pathwise divergence between arithmetic expectation and time-average (ergodic) compounding still catches a lot of intuitive sizing heuristics off guard.

I coded a deterministic simulation walking from negative/zero-EV progression traps (9-step Martingale on a $1–$500 cap, N=1,000) all the way to non-ergodic overbetting on a genuinely profitable 60/40 even-money edge:

  1. The Non-Ergodicity Trap (p = 0.60, b = 1, staking f = 50% over 100 rounds):

• Ensemble mean across parallel paths: +10%/round → $1,000 × (1.10)^100 = $13,780,612 (13,781x)

• Typical single timeline (exact 60W / 40L): $1,000 × (1.5)^60 × (0.5)^40 = $33.46 (-96.7% drawdown)

2. 200-Round Compounding Race on the exact same shuffled sequence (120 wins / 80 losses, $1,000 start):

• Conservative (f = 5%): $5,762

• Half-Kelly (f = 10%): $20,255 (captures 75% of max log-growth rate g(f) with 25% of the variance)

• Full Kelly (f* = 20%): $56,098 (theoretical peak g(0.20) = +2.01%/round)

• Over-leveraged (f = 45%, past the 38.7% zero-growth cliff): $39 (-96.1% wipeout despite a 60% win rate)

It makes it crystal clear why Thorp and institutional desks treat Half-Kelly as an upper bound once parameter uncertainty enters p and b: underbetting by 50% costs 25% of asymptotic growth, whereas overbetting past 2f* turns a +20% EV signal into mathematical ruin.

If anyone enjoys visual stochastic simulations, I rendered the full 9-minute trajectory breakdown (from Martingale & Doob's Optional Stopping Theorem to the Kelly curve) here: https://youtu.be/bfUaw0pujzE?si=HtGLjd220QtS5H-D


r/mltraders • • 4d ago

Question Do you trade on the model's probability or just its yes/no?

1 Upvotes

When a classifier says "up", it also gives a number for how sure it is. I keep going back and forth on how much that number should matter.

For those running ML models on markets:

  • Do you only take trades above some probability cut-off, or every signal?
  • Do you size by the probability, or keep the size fixed?
  • Did you calibrate the probabilities, and did it change anything?
  • How do you pick the cut-off without just fitting it to the backtest?

Curious how you actually use it, not the textbook answer. All replies are appreciated.


r/mltraders • • 4d ago

Quantum Algortihims for the new trading engine?

0 Upvotes

🤖💰

Scared money makes no money, but your sizing math is cold-blooded! 📈🔥

I can't wait to have someone to give a compliment like this too other than my wife hahah

Just married 8 months ago she was a coder before me I graduated '22 when I started the LLC.

I see some of you literally out-pricing the market-makers right now! 🧠⚡

Keep up the good lords work genius


r/mltraders • • 4d ago

Two leakage bugs in my backtest turned a losing idea into a +$85 "winner". Not ML, but the same trap

0 Upvotes

My bot is rule-based, not ML, but I think this is the same leakage and selection problem you all deal with, so sharing in case it saves someone time.

The idea: on SOL, keep the normal trades and add extra positions with a much wider stop-loss, so they can sit through a dip and wait for the recovery. Tested walk-forward: pick the setting on the previous 6 months, trade it blind on the next quarter, 6 quarters.

First result: +$85. Looked like one of my best ideas.

Bug 1, dropped outcomes. Trades that hadn't hit their stop or target by the end of a test window were silently dropped instead of marked at the window's last price. So the trades stuck underwater just disappeared from the results. Basically survivorship bias inside my own test.

Bug 2, look-ahead across windows. Trades opened in one window were allowed to keep running into the next one, so they could collect a recovery that happened months later, in data the setting was never supposed to see.

Both bugs flatter exactly one kind of idea: "hold longer". Fixed (mark open trades at the window end, close everything at the boundary), the idea lost money at every size: −$18, −$43, −$82.

Two other things that bit me on the selection side

  • Hindsight picking. An ATR-based stop beat my fixed stop when I chose the best multiple on the full history. Chosen walk-forward, it lost. Same on all 5 coins I trade.
  • One window can be the whole edge. A breakout entry on ETH was positive walk-forward in total, but nearly all of it came from a single quarter. I now count how many windows an idea wins, not just the sum.

And the scale problem: I ran over a million rule evaluations on ETH alone, so even with walk-forward some winners are just luck. Out of ~100 ideas, 2 survived.
All numbers are backtests with fees. Code and every report, the broken script included, are here if useful: https://github.com/zulfi011/z-bot


r/mltraders • • 4d ago

The Powell 10am setup only made money on NQ when NQ was already going up, here's the regime split from 535 trades

3 Upvotes

I ran the Powell 10am strategy on NQ 1m candles from july 2023 to feb 2026 in Agenticks, 100k account, 1 contract, and the headline was bad enough on its own: 535 trades, 60.2% win rate, profit factor 0.98, net -$3,675.

It gets worse when you split those same trades by market condition.

  • Uptrend: 152 trades, profit factor 1.08, +$3,307
  • Volatile: 280 trades, profit factor 0.93, -$6,764

Over half the trades landed in volatile conditions and that is where all of the damage came from. The only stretch where it made money was when the NASDAQ was already trending up, and buy and hold over the same window took 100k to roughly 170k while this finished down 3.7%.

Anybody who happened to run it through a strong trending month would have seen something that looked like an edge, and it would have been the index doing the work with the setup along for the ride. Thats the trap with testing long ideas on NQ over the last couple of years, the underlying kept making highs so a lot of them look fine until you split the results.

What I check now before trusting any result is whether it still holds up once the trending months are pulled out, and whether it beats just holding the thing. This one failed both, which is why the 60% win rate never mattered, the average loss was $806 against a $522 average win.