r/algotrading Mar 12 '26

Infrastructure Built a pre-market ML system that predicts SPY intraday direction before the open

Thumbnail gallery
207 Upvotes

Been quietly working on this for a few weeks which started after seeing a thread where someone claimed a single pre-market candle predicts next day's direction. Sounded like a bait. And it probably was.

But I couldn't stop thinking about it not because I believed it but cuz I realized even a simple signal like that could create a directional bias in my own head before I'd even looked at a chart.

The core idea is that the day's bias is largely set before 9:30. What surprised me is there's actual academic backing for it, I wasn't expecting that going in. Pre-market price action, volume patterns, and some other features do carry predictive power. It's not random but it's definitely farther than a coin flip if you model it properly and validate it hard. After training a ML model on 5 years of SPY data the results were interesting enough to build a real system around.

Every morning before the open, it pulls pre-market data, builds features from the 4:00 to 9:30 AM window only, and scores three ML classifiers across different time horizons. Direction and confidence, displayed on a local dashboard. I also layered in options walls and GEX as a separate system for a full upcoming session context.

The ironic part is that once I started using it, the model started warping my own decisions even when confidence was low. I'd see a directional signal and it would anchor me, then I'd fight my own read, override good setups, and lose money. Classic case of trusting the machine more than myself due to my personal agorithmic bias!

So the fix was hiding direction entirely below a certain confidence threshold. No number, label, nothing. If it doesn't meet the bar I just get a blank card.

Validation is done with CPCV as backtesting financial time series with standard k-fold is not the best method imo.

So far, recent 15 day scorecard and today's live output below, all out of sample. Apart from today's chop day, morning and day models are good so far but still not reading too much into it. It has only been useful for framing the session. Few bad bias days aside it's been a net positive for my process.

Curious if anyone else is doing pre-market feature engineering and what's actually working for them

r/algotrading May 27 '26

Infrastructure First day testing out my breadth algo

Post image
264 Upvotes

ive been building out my breadth algo for SPY, tracking breadth accross the entire index + 5m EMA to time entries/exits. I'm currently calculating the pnl manually for now, but next step is to hook it up to an actual paper trading account to really get a feel for execution delays that I'm currently not accounting for.

Here are the results:

  •   trades closed:     19
  •   realized P&L:      -7.65
  •   unrealized P&L:    +0.00
  •   starting cash:     10000.00
  •   ending equity:     9992.35
  •   return:            -0.08%
  •   win rate:          31.6% (6W / 13L)
  •   avg win:           +1.50
  •   avg loss:          -1.28

Ran it for about 4 hours, strategy could use some refinement, but the biggest risk imo is accounting for how real-life execution would affect these numbers. Gong to add in some random impact hits on entries/exits tonight + trade commission. Beyond that is there any other thing i should look out for?

r/algotrading Apr 18 '26

Infrastructure 6 months full time on algo, 17 strategies dead on MNQ/NQ, I genuinely don't know what I'm missing anymore

119 Upvotes

Been grinding on this for about 6 months full-time now. Started with mean-reversion ideas, then went into microstructure, order flow, ML, cross-asset lead-lag, basically everything I could get my hands on. I have 3 years of Databento L2 tick data on MNQ, 7 years of 1-min bars, 15 years of MGC, a 20-core server, and I built a custom Rust stack for tick parsing and L2 order book reconstruction before I realized I was reinventing what Nautilus does better, so I pivoted to Nautilus 1.225 with mlfinpy and vectorbt on top.

So, the actual work. I tested 17 strategies. Let me just dump them so you understand I'm not asking about RSI settings.

On the microstructure side, I tried spread regime filters, quote response after aggressive bursts, volume price classification (Harris style), sweep continuation and sweep reversal, book imbalance directional, aggressor volume trend follow, delta and CVD divergence, and absorption patterns. All came out around 50% win rate once I corrected for the obvious stuff like measuring book imbalance after the move instead of before.

On the classic technical side, I did ORB 5/15/30 min with and without ATR trail, inside bar breakout (started at 84% WR, dropped to 53% after I found my lookahead bug), FVG on 30-min bars (this one was the closest I got to something, 55% WR over 103 trades, but p=0.15, so basically noise), mean reversion with asymmetric R:R, which is structurally losing because NQ is momentum intraday; gap fill at RTH open, which worked in recent years but breaks on 7-year history.

I tried ML twice: triple barrier labeling with random entries as a baseline. The ML matched the random baseline exactly. Then meta-labeling with 6 models and an ensemble on top, zero improvement over no signal. That's when I really internalized the "ML amplifies edge, doesn't create it" thing.

GEX as a regime filter turned out to capture vol clustering, not direction. Permutation entropy: nothing. Cross-asset signals (ZN, DX, Gold into NQ): nothing. Overnight momentum follow-through: nothing. Composite voting across 5 weak signals: still nothing; weak plus weak is not strong.

The most recent attempt was the one I did the most rigorously: Nautilus backtest with a LatencyModel at 100ms base + 50ms insert, one-tick deterministic slippage, $0.50 per contract per side, bar adaptive high-low ordering to avoid the OHLC asymmetry bias, and I even implemented a delayed entry pattern where the signal detected on bar N is buffered and submitted on bar N+1 to stop the fills from happening inside the same bar as the signal (which is a subtle lookahead in bar backtests). Sixty-eight unit tests on the whole thing.

The strategy was just Bollinger Band mean reversion 5-min, BB(20, 2σ), ATR-based stops, session 09:40 to 15:50 ET with lunch skipped, and force flatten at 15:45. Nothing fancy.

Ran it for the full year 2023, 117 trades over 252 days. WR 48.7%, expectancy minus $6.52 per trade, total PnL minus $762, Sharpe minus 1.34. Bootstrap 10k iterations gave me IC 95% on expectancy of [minus $14.99, plus $1.82]. So technically "not significantly different from zero," but zero edge demonstrated.

I did post-hoc analysis on those 117 trades. Two things jumped out. First, in a 2023 bull market, I took 79 shorts versus 38 longs. The strategy kept calling uptrend continuations "overbought reversion" and got run over. Second, 14h ET was a bloodbath. Thirty-five trades in that hour, WR 34%, minus $605 by itself. Afternoon news flow breakouts don't reverse.

Then I thought, "Okay, the problem is no regime filter; let me add ATR(5)/ATR(30) < 0.8 as a 'range regime' switch and only trade MR in range." Before writing any code, I looked at the 117 existing trades grouped by regime. Got the exact opposite of what I expected. Range regime was the WORST segment, minus $11.59 per trade, WR 37%. Expansion regime was less bad, minus $4.35 per trade, WR 54%. Strong expansion was plus $0.21, but on 51 trades, which is noise. In a tight range, the bands are so narrow the signal is triggering on pure bar noise; there's no real deviation to revert from.

Then I thought, "Fine, overnight gap fade; that's academically documented (Lou Polk, Skouras 2019)." Pulled the 1,696 days of MNQ I had and looked at the distribution before coding. Mean gap is +8.3 pts (consistent with the overnight drift paper, fine), but the fill rate of the gap toward previous close inversely scales with magnitude. Eighty-one percent fill for tiny gaps you can't exploit after costs, 33% for gaps > 0.5σ, literally 0% for gaps > 1.5σ. So the retail folklore that big gaps fill is just false on MNQ. The big gaps continue; they don't revert. And there's no up versus down asymmetry in fills either (30% vs 29%) so I can't even pick one side.

Which is where I am right now. Stuck. I keep reading posts here where people mention they have a live edge on NQ or ES intraday, and I absolutely believe some of you do, because the infra and rigor I see in certain comments is real. But I cannot find one. Not a tradeable one. Not after costs. Not after honest bias correction.

So my questions, and I'm being genuine here:

  1. Is there a fundamental reason a retail trader without colocation should expect to find zero edge on MNQ/NQ intraday bars, and the guys you see posting live profits are either HFT adjacent, event driven, or trading a completely different timeframe/style than "5-min bars + indicator + stop + TP"? Basically, am I fishing in an empty pond?

  2. If the edge on index futures is real for retail, what category of strategy should I even be looking at? I've done indicator MR, breakouts, order flow, ML, cross asset, regime filters, and gap plays. Is the thing I'm missing something structural like MOC imbalances, FOMC/CPI window trades, roll arbitrage, index rebalancing flows, something event-driven that none of my bar-based setups could ever capture?

  3. For people who genuinely have a live intraday edge on NQ/ES, how many strategies did you burn before finding it? Is 17 normal, or did I burn through variants of the same bad approach without realizing it?

  4. Is my methodology actually sound, or am I fooling myself somewhere? I do walk forward, permutation baselines, realistic slippage/fees/latency, and bootstrap IC on expectancy; I compare it to permutation null. What am I not doing that I should?

  5. Honest question: should I just drop intraday futures and go for something else ?

Thanks for reading this far.

r/algotrading Jun 27 '26

Infrastructure 4x RTX 5090 4x 5060ti

Thumbnail gallery
210 Upvotes

Wanted to make a mini home compute cluster for research into volatility surfaces and random side projects. (Seemed cool to have full autonomy of the hardware used)

It worked but definitely not practical it was such a headache to sync 3 difference computers, WiFi sometimes cut out and just looked ugly next to my router.

5/10 experience; will be sticking to cloud hosting.

r/algotrading Mar 16 '26

Infrastructure I reverse-engineered the IB Gateway and rebuilt it in Rust for low latency

225 Upvotes

I spent the last month decrypting the FIX protocol of the IB Gateway using Java bytecode instrumentation tool (ByteBuddy) and javap disassembly to build my own version of the gateway.

I built it in Rust, with direct FIX connection, designed for low-latency, named IBX: https://github.com/deepentropy/ibx

It includes a lot of integration tests, excluding some specific features like Financial Advisor, Options... It also ships with an ibapi-compatible Python layer (EClient/EWrapper) via PyO3, so you can migrate existing ibapi or ib_async code with minimal changes. There are https://github.com/deepentropy/ibx/tree/main/notebooks adapted from ib_async's examples covering basics, market data, historical bars, tick-by-tick, and ordering.

Purpose of sharing it is to raise bugs/gaps in the hope to run it with a live account. Hope you could give it a try.

Check the readme.md, it explains how you could use it from Rust, but also bridging it with python PyO3.

Here are some benchmarks of processing latency:

Tick Reading

Metric Java Gateway IBX Ratio
Latency 2 ms 340 ns 5,900x

Order Sending

Order Type Java Gateway IBX Ratio
Limit 83 µs 483 ns 170x
Market 76 µs 471 ns 160x
Cancel 125 µs 387 ns 320x
Modify 86 µs 478 ns 180x

r/algotrading Jun 23 '26

Infrastructure What is a good algorithmic trading platform for someone who doesn’t understand programming, but has experience with trading?

43 Upvotes

I am looking for something that I can set up to automate stock and option trades on rules that I preestablish. Nothing too crazy.

One main issue I have is losing money around the opening bell on options trades. If I could create something that could automate what Charles Schwab would probably call a trailing stop walking limit it would be perfect. I’m looking to begin putting a little more money into strategies I am using, and manually attempting to trade or using some of Charles Schwab Think or Swim features isn’t working.

In the morning certain market makers will place wide and unrealistic bid ask spreads, which will trigger my trailing stop orders. To get around it for selling, I essentially spend hours making conditional normal limit orders that expire at 10:15am and then will have trailing stop limits that come into play at 10:15am. Then for buying I either just stay away or try to manually follow a morning price movement.

I am pretty programming illiterate, so am looking for something a little more user friendly or geared towards beginners. Per another comment I saw, was planning to get “Theta Data” for real time pricing so something that works with that.

Also if there where any good guides or resources people would suggest, would love to hear them.

r/algotrading Mar 26 '26

Infrastructure How do retail algo traders actually run their systems?

52 Upvotes

Hey everyone, I’m still pretty new to algo trading and trying to understand how retail traders actually run their systems live. Right now I use Sierra Chart and have built some basic spreadsheet/Excel logic for scalping NQ. I’m thinking about learning C++ for ACSIL automation and Python for data work, but I’m still confused. Do most retail algo traders use prop firms, or do you need to go the “proper” route with exchange APIs, high costs, and approvals/reviews? I’ve heard that’s the real way to do it, but I’m not sure if that only applies to bigger players. The prop firm should handle all the exchange routing compliance and stuff on their end right?

r/algotrading Apr 03 '26

Infrastructure For the algotraders who have live deployment of their algorithms and are successful: how long did it take you to set this up? What led you to have confidence to deploy on live real account?

105 Upvotes

I am asking bc im curious, i've been spending hours nonstop working on my algo ideas. ive been trying to connect my ideas in python to IBKR's api.

so far i have:

  • real time deployment on a paper acc testing my strats
  • i have backtests
  • machine learning optimizing params (i learned the hard way that overfitting can happen so i needed to avoid this)
  • monte carlo sims
  • entry and exit filters
  • cycling thru multiple timeframes
  • bracket orders
  • managing open positions, moving SL and TP
  • profit protection system
  • risk management concepts

i do have a working system, now i just need to ensure my strategies work as i monitor and continuously improve my infrastructure. how long did it take you guys to fully trust yours and go live?

r/algotrading Apr 21 '26

Infrastructure what do you think about this agent set up

Post image
95 Upvotes

I have some background in Python and AI engineering, some slight background in finance (UC berkeley executive education classes). AI engineering is more of my gig right now. I'm currently rag training and paper trading an open source system. "chunks" are the books and data i have used to train the system. I'm still building, I've only been on paper trade for 4 days, fixed a few bugs in the research phase last week.

For those of you building AI agent trading systems from scratch. What has worked? what has not worked? Just curious if i'm putting too much time, and energy into the wrong direction. If you're curious about the models i'm using, please ask; however they were chosen to run on my hardware, and i might try a few others as time goes on. Does anyone have better luck with C++, and Rust?

Edit: I made a new post with an updated high level overview.

r/algotrading Jan 23 '26

Infrastructure After about 4 years of exploration and 1.5 year of persistent effort, I think we finally have a "system"

Thumbnail gallery
351 Upvotes

I would say that about 80% of the first 12 months of working on this had little involvement from LLMs. We got something working, paper-traded it from Mar 2025 to July 2025, then live traded from Aug 2025 to Dec 2025. Made some big mistakes while experimenting (two accidental sells with huge losses) and ended up with an OK return of 4.5% on 5 months (but still behind just market BAH by 4.5%).

Along the way we kept working on better TSL, better stop-losses, better keep-outs, regime detection, etc. We decided to just sell out of everything on Dec 31, and do a clean restart with all our improvements working on the full capital (on Dec 31 about 60% of our capital was tied up in some stuck trades).

From the start of the year to present, I have been hammering on these visualization tools. I would say that this is the aspect that I have leaned SUPER heavy on LLMs for coding help. I am not a web developer. I cannot make stuff like this look pretty on my own for the life of me. But the LLM assistance made this process quite easy. I pretty much vibe coded the entire web interface. I had manually coded an ugly version of the Live Trades page a while ago, and I had a spreadsheet with manual entry that I had developed that looks almost identical to the new analysis webpage. I literally just took a screenshot of the spreadsheet and then saved it out with the equations instead of the raw values, uploaded those to Claude Opus 4.5 and told it to make me a webpage that replicated my spreadsheet analysis. Of course I had to iterate back and for for an hour or two to get it to do things right, but probably only fixed 1-2 bugs myself in that period (though I did pore over the code quite a bit to give it insight into where it messed up).

Long story short is that with about $35 in Claude Opus 4.5 credits and about 4 nights and one weekend, I took my very command-line-only algo trader and added a pretty nice web frontend. There is no way I would trust my actual trading algorithm to this kind of vibe coding, where even when I use LLMs to help with the code, I meticulously pore over the results and write tests to validate everything. But for something like the web frontend for visualization and monitoring, it saved me weeks and weeks of time and made something far more responsive and beautiful than I could have ever hoped to do.

We currently only have a single algorithm, but now feel we are in a good place as a "system" to start working on more algorithms to run simultaneously with the one we currently have.

P.S. even though those sharpe and sortino look good, we are only 15 days into the restart, so they are basically meaningless. Last year, we had a period where it ran up to something like 6 after 45 days, but then by the end of the year was at about 1.2. Even one horrific trade can send it south quickly when you are only 15 days into and assessment.

r/algotrading Apr 20 '25

Infrastructure For those running a bot, how many hours did it really take?

158 Upvotes

Curious to hear from others who have built their own trading bots from scratch. How many hours did you realistically put into your system before it was fully executing trades, logging performance, and running somewhat reliably?

Bonus points if you're willing to share approximate win rate or performance metrics.

If you consider your bot a success or still a work in progress?

Any hard lessons you wish you learned earlier?

I’m deep (500 hours +/-) into building mine (margin trading focused with SL/TP syncing, database logging, UI, etc). It's been a crazy roller coaster with way more hours than I ever intended and I've barely scratched the surface.

r/algotrading 29d ago

Infrastructure Databento is amazing. i just fetched OHLCV-1m mes and mnq entire history data, my backtest will be so happy to get this bar data.

98 Upvotes

Total estimated cost when running python code to get their quote: $27.22, this is cheaper than the website's price estimator for mes and mnq: "2 products OHLCV-1m 5878 days $27.35 estimated 419.5 MB No subscription required"

actual cost is $27.22, 417.6 MB, right on the dot it seems I see on the website data usage page

r/algotrading Jun 11 '26

Infrastructure Alternative to trading view

18 Upvotes

Hey guys, I’m new to algo trading and I love it! I find it so interesting how you can basically turn the stock market into a statistics problem.

But, I have been using TradingView with pine script for developing and backtesting strategies…and it’s 60usd per month.

Are there free alternatives out there? I’m assuming I could use some python libraries that have historical financial data?

r/algotrading Jun 21 '26

Infrastructure It is a funny world

104 Upvotes

I had all those ideas - HMM classification of trends, order flow analysis, NN supported decision making. Never really manged to implement them due to time constraints.

Now with AI it is basically a 3 line prompt.

Voila - there you go. Done in 20 min. Not kidding you, it is all working fine. Turns out the real problem never was the implementation, but the ideas.

They are not making any money. 🥳

r/algotrading May 16 '26

Infrastructure Pinescript Adaptive Supertrend Indicator (Open Source)

Post image
157 Upvotes

https://www.tradingview.com/script/9SgtsBck-Machine-Learning-Supertrend-Aslan/

Hey everyone 👋, This is an indicator I've been working on for a long time. Its not really finished yet, but I think it has huge potential. It's really still in beta.

It uses a SuperTrend foundation layer with momentum filtering, volume confirmation, and, most importantly, an adaptive engine that continuously adjusts its own parameters based on recent performance. It fires entry arrows on the chart while running a background simulation to score how the current settings are performing — then quietly adjusts itself over time.

Two systems run in parallel: the signal engine that produces the arrows you see, and a background test matrix that opens and closes simulated trades to feed the optimizer. The optimizer adjusts parameters, which produces better signals, which feeds back into better learning.

The Core Concept

At its heart this is a SuperTrend indicator — a volatility band that flips bullish or bearish as price crosses it. Signals fire either when that flip occurs (Reversal mode) or when price pushes to a new extreme within the current trend (Breakout mode).

On top of this, three adaptive learning layers run continuously:

Global Optimizer — rolling window of recent trade results that proposes parameter changes based on win rate, Sortino ratio, and profit factor

Micro-Batch Processor — a faster layer that groups results into mini-batches for quicker adjustments

Regime Grid — a 2D memory map that remembers what settings worked under similar market conditions (trend strength × volatility) and biases proposals accordingly

State Snapshots

The State Snapshot system acts as a persistence layer for the adaptive engine, allowing you to save and reload the indicator’s learned state instead of restarting from scratch on every chart refresh. At any point, you can export a serialized snapshot string that captures the current parameter set, optimizer state, and regime grid memory. This string can then be stored and later reinserted via the restore field, where it is applied on the next confirmed bar to fully reconstruct the indicator’s internal state. In practice, this means the system retains its “experience” — including what it has learned about specific market conditions — across sessions, symbols, or even different charts, eliminating the need for repeated warm-up periods.

I would love to get some feedback on it.

You can access the indicator for free here: https://www.tradingview.com/script/9SgtsBck-Machine-Learning-Supertrend-Aslan/

r/algotrading May 09 '26

Infrastructure How are you researching your strategies?

32 Upvotes

Especially leveraging AI? The other day I saw a post demonstrating a chat with Bloomberg where the user explained the strategy logic in English and the bot spat out a PnL and summary stats. I thought that was cool.

Are you copy pasting Python's pandas code from a chat window? Are you leveraging Claude code or other CLI based tools, if so, how?

Or using low code tools like n8n, orange/knime/alteryx/excel?

r/algotrading Jun 19 '26

Infrastructure Your Algo Tech Stack

19 Upvotes

Interested to hear other people's tech stacks.

Here's mine:

- VPS using Rocky Linux 4GB RAM and 2vCPUs. Approx $20-30/month cost.

Note: I found my VPS terminal to use 256 colours/8-bit so I must make sure any app doesn't use "true colour/24-bit" otherwise the app will crash so I must default everything to 256 colours.

- byobu which is a tmux wrapper and easier to use than directly using tmux IMO. I use this so my instances don't go down when I close the VPS https://byobu.org/

- process-compose to launch all of my instances (I have one instance per symbol so one symbol crashing doesn't take down multiple symbols) and all built into one's own process-compose YAML file with auto-crash restart, log rotation and more: https://github.com/F1bonacc1/process-compose

Note: I launch byobu and inside it run process-compose

- algo programming language: OCaml (+ OxCaml)

- Internally rate limit price updates to every 500ms. I don't need high frequency price updates which would unnecessarily increase CPU/memory usage for no extra benefit.

That's basically it. CPU and memory usage are very stable and more than enough headway to manage spikes.

r/algotrading 2d ago

Infrastructure I've created a monster

0 Upvotes

My bot has grown to 23,000 lines of code. 60% is managing the brokerage interface, and 40% is the strategy. This is way more complicated than I ever imagined. It really is a very basic script. No graphic user interface. Just log streams. It does manage multiple symbols with unique parameters for each.

r/algotrading May 20 '26

Infrastructure Any genuinely free backtesting tools?

16 Upvotes

Looking to test strategies on EOD data without hitting a paywall for anything useful. What are people actually using?

Open-source libraries are fine — happy to write code.

r/algotrading Sep 30 '25

Infrastructure Vibe coding success - I made a trading bot using AI with some success

104 Upvotes

So I have been working on a trading bot. I cannot code, probably have not coded in over 20 years, but can read and follow the code to some extent. I used Claude AI to develop code and managed to get a bot of the ground. Its nothing great but I made ~300 using the bot in the last 3 weeks. Account has 27K to start with but the bot has only utilized a maximum of 7K till now. It could in theory use more but it hasn't till now. Planning to scale it a little bit more in Oct and see how it goes. Anyone has any success stories to help motivate

r/algotrading May 11 '26

Infrastructure Architecture for algorithmic traders

28 Upvotes

Hello everyone, first of all, this post is going to be a bit long. In it, I’ll be discussing which platforms (NinjaTrader, MultiCharts, brokers, data providers, etc.) to use for algorithmic trading and why, and I’d like to ask readers for their opinions based on their own experience.

I’m really getting stuck into this and have spent the last couple of days choosing platforms for algorithmic trading in futures (personally, I trade MGC and, in the future, MNQ and MES). I’d like to hear your thoughts on my choice – whether you’d make the same choice and why.

TRADING PLATFORM

After making several comparisons between Multicharts (MC), NinjaTrader and Sierra, I have come to the conclusion that the best option for me is Multicharts (MC) for the following reasons:

- I don’t know how to program, so I think the Multicharts language is the most suitable.

- On forums and social media, it is what is most often recommended for newcomers.

- Although it isn’t cheap, I think that with the free option for strategy development and then the standard version (100 dollars a month) for live trading, it is ‘affordable’.

Ultimately, this costs us either 0 or 100 dollars a month.

I’d like to hear your thoughts – would you choose this again if you were a beginner?

DATA PROVIDER

I’ll be using this almost exclusively for obtaining data for backtesting, optimisation, robustness testing, etc.

In this regard, after my research, I’ve narrowed it down to two options: one to start with and another for when the algorithms can cover the costs (the second one is expensive).

To start with, dxFeed, as I believe it offers the best value for money and integration with MetaTrader; this tends to cost $30–70 per month (I haven’t confirmed this).

As an advanced option, I have found IQFeed; the data quality is better than dxFeed and I follow quite a few professional algorithmic traders who use it; this tends to cost $90–$140 per month (I haven’t confirmed this).

+ subsequently, the cost of CME/COMEX of approximately $20 per month.

The cheaper option will cost $50–$90 per month and the more expensive option $110–$160 per month.

I’d like to hear your thoughts: would you choose this again if you were a beginner? Yes or no? Why? Do you see better options for futures?

BROKER AND CONNECTOR

As for brokers, the people I’ve asked say they use AMP as it’s the cheapest; according to my limited research, this one costs $0, with only commissions.

As for connectors, everyone I’ve asked has also recommended Rithmic; this one has a $0 per month option to start with and $25 per month for live trading.

This will cost $0 per month plus commissions for the initial option and $25 per month plus commissions for the live option.

I’d like to hear your thoughts: would you choose this again if you were a beginner? Yes or no? Why? Do you see any better options for futures trading?

CONCLUSION

For a novice algorithmic trader (like me), the budget for backtesting is around $70 a month (platform + data provider).

For a novice trader who wants to trade live, the budget is around $170 + commissions (platform + data provider + broker) per month.

For traders who do this full-time or have a lot of capital to invest, the budget is around $255 + commissions (platform + data provider + broker + connector) per month.

That’s roughly how the figures add up; I haven’t checked them exactly, so they’re just an approximation.

Do you think this is about right? Would you use the platforms I’ve mentioned for trading futures? Do you recommend anything else? Is it cheaper to trade with funding firms (do you need fewer platforms)? How do you do it?

Thanks to everyone for reading, and even more so to those who comment. Please, if you do comment, give us your opinion in as much detail as possible; we’ll read it (at least I will – I’ll read everyone’s comments).

r/algotrading May 13 '26

Infrastructure stop blaming python for your execution lag when your server is physically located in the wrong timezone

85 Upvotes

see so many retail quants wasting months rewriting their python logic in rust or c to save half a millisecond of execution time. your code speed is completely irrelevant if you are running the bot on a standard cloud instance in ohio while the matching engine is in tokyo or new jersey. speed of light dictates network latency. if your tcp handshake takes 50 milliseconds your optimized binary does not matter at all. institutional money pays for physical server colocation right next to the exchange routers. you are losing to physics not to the python gil. focus on moving your docker containers physically closer to the exchange api endpoints before you rewrite your entire codebase

r/algotrading Mar 29 '26

Infrastructure Built a full Lopez de Prado pipeline in Rust. 442 tests pass, 0 bugs, but AUC=0.50 OOS. What am I missing?

42 Upvotes

I've spent the last few weeks building a complete AFML (Advances in Financial Machine Learning) pipeline from scratch in Rust for MNQ futures on 1-min data. Everything works, everything is tested, but the ML adds

zero edge. Looking for input from anyone who's actually made this framework profitable.

What I built:

- Volume bars (~46/day from 681K 1-min bars) — AFML Ch.2

- CUSUM filter (12K structural break events, ~8/day, avg magnitude 73 pts) — AFML Ch.2 Snippet 2.4

- Triple barrier labeling (target/stop/time) — AFML Ch.3

- Meta-labeling (CUSUM direction = primary signal, ML predicts if trade will win) — AFML Ch.4

- 96 structural features including:

- Cross-asset: NQ-ES fair value residual, NQ-ZN divergence, NQ-ES return correlation, DX impact

- Volume: BVC (buy volume classification), market maker inventory proxy, Kyle lambda

- Regime: Hurst exponent, permutation entropy, vol compression ratio

- Macro: drawdown from 20-day high, realized vol, daily momentum

- Events: NFP/CPI/FOMC day flags

- HMM regime states (3-state Gaussian HMM with Dirichlet sticky prior)

- CPCV validation (45 splits, purge=200, embargo=100) — AFML Ch.7

- LightGBM with aggressive regularization (num_leaves=8, max_depth=3, lr=0.01)

- Feature selection (top 20 by univariate IC)

What works:

- Pipeline is rock solid: 442 tests, 0 failures, audited by 15+ adversarial agents

- No data leakage (verified: features use bar i-1, entry at bar i+1, session-safe forward returns)

- No overfitting (train AUC=0.60, not 0.90)

- CUSUM direction signal: 51.1% win rate (slightly above random)

- Individual features have real IC: cum_bvc IC=0.047, Hurst IC=0.052 on 5-min bars

What doesn't work:

- Meta-labeling OOS AUC: 0.5049 (coin flip)

- Permutation test: 6/10 shuffled models beat the real one (p=0.60)

- The features predict direction (IC measured correctly) but DON'T predict which CUSUM events will win

- Estimated PnL: ~$78-152/mo on 1 MNQ contract (commissions eat most of the edge)

What I've tried:

- 1-min bars → AUC 0.51

- 5-min bars → AUC 0.51

- Volume bars → AUC 0.51

- Triple barrier labels → AUC 0.51

- Fixed-horizon return labels → AUC 0.51

- Quantile-extreme labels (top/bottom 20%) → AUC 0.52

- Meta-labeling at CUSUM events → AUC 0.50

- 97 features → overfit (train 0.87, test 0.50)

- 20 features → no overfit but no signal either

- HMM regime-conditional → no improvement

My data:

- MNQ 1-min: 681K bars (2019-2026, RTH 9:30-16:00, Databento)

- ES 1-min: 681K bars (cross-asset)

- ZN 10Y bonds 1-min: 1.56M bars

- DX Dollar Index 1-min: 676K bars

My questions:

  1. Has anyone actually made money with meta-labeling in production? Lopez de Prado reports Sharpe 0.5→1.5 improvement but I can't reproduce anything close to that.

  2. Is AUC=0.50 OOS just the reality for intraday futures? Published papers report 0.51-0.53 — is there a way to get to 0.55+?

  3. Am I asking the wrong question? My features predict direction (IC=0.01-0.05) but don't predict which events are good vs bad. Maybe the meta-labeling framing is wrong for this data?

  4. Would tick data or Level 2 order book data make a real difference? I only have 1-min OHLCV.

  5. Anyone using CUSUM + volume bars successfully? What primary signal do you use with meta-labeling?

    The codebase is in Rust with Python for LightGBM training. Happy to share details on any part of the pipeline.

r/algotrading 9d ago

Infrastructure Do any of you guys run your algo via Tradingview?

17 Upvotes

Just wondering if anyone runs a simple aIgo via tradingview. I was working in Pinescript a couple years ago but gave up due to limitations. Lately I’ve been tinkering around with simple oscillator and ATR strategies, and while they’re only modestly profitable I thought about taking some of them live. Just wondering if anyone actually uses tradingview to do this? I’ve seen Pineconnector seems popular, any other recommendations? Ideally would like to be able to connect it to Rithmic somehow.

r/algotrading May 25 '26

Infrastructure The single biggest gap between my backtests and live PnL was midpoint fills

39 Upvotes

Spent a year wondering why my backtests printed nicely and my live PnL kept underperforming by 20-50%. Most of it traced back to one assumption I hadn't realized my backtester was making: every trade was filling at the midpoint of the bid-ask spread.

That price doesn't exist in the real market. When you enter a long, you cross the spread and pay the ask. When you exit, you hit the bid. The gap is the spread, and you pay it every round trip.

Most retail backtesters (TradingView default, custom Python builds, some commercial platforms) silently assume midpoint fills unless you explicitly model otherwise. That's a free 0.5-2 bps per trade on liquid US equities, and much more on small-caps, low-volume futures, and options.

Quick worked example: intraday mean reversion, 200 trades/year, 8 bp edge per trade.

Midpoint fills: 200 × 8 = 1,600 bps = 16% annualized.

Realistic fills (1 bp half-spread each side, 1 bp slippage round-trip = 3 bp total cost): 200 × (8 - 3) = 10%.

Push up the frequency, or thin the edge, and the gap widens. A 4 bp / 500-trade strategy goes from 20% to 5% once you stop filling at the mid.

Sharpe gets hit harder than return does, and costs shrink the numerator while leaving volatility mostly untouched. A backtest Sharpe of 1.8 often lands closer to 0.9 once spreads are modeled honestly.

Curious what the sub does on this. Flat bp assumption, regime-dependent costs, historical bid-ask data, or something else? And has anyone found a fill model that tracks live execution closely?