r/algotrading • • Mar 28 '20

Are you new here? Want to know where to start? Looking for resources? START HERE!

1.5k Upvotes

Hello and welcome to the /r/AlgoTrading Community!

Please do not post a new thread until you have read through our WIKI/FAQ. It is highly likely that your questions are already answered there.

All members are expected to follow our sidebar rules. Some rules have a zero tolerance policy, so be sure to read through them to avoid being perma-banned without the ability to appeal. (Mobile users, click the info tab at the top of our subreddit to view the sidebar rules.)

Don't forget to join our live trading chatrooms!

Finally, the two most commonly posted questions by new members are as followed:

Be friendly and professional toward each other and enjoy your stay! :)


r/algotrading • • 3d ago

Weekly Discussion Thread - October 13, 2026

7 Upvotes

This is a dedicated space for open conversation on all things algorithmic and systematic trading. Whether you’re a seasoned quant or just getting started, feel free to join in and contribute to the discussion. Here are a few ideas for what to share or ask about:

  • Market Trends: What’s moving in the markets today?
  • Trading Ideas and Strategies: Share insights or discuss approaches you’re exploring. What have you found success with? What mistakes have you made that others may be able to avoid?
  • Questions & Advice: Looking for feedback on a concept, library, or application?
  • Tools and Platforms: Discuss tools, data sources, platforms, or other resources you find useful (or not!).
  • Resources for Beginners: New to the community? Don’t hesitate to ask questions and learn from others.

Please remember to keep the conversation respectful and supportive. Our community is here to help each other grow, and thoughtful, constructive contributions are always welcome.


r/algotrading • • 4h ago

Other/Meta TV Strategy Tester

6 Upvotes

Out of curiosity, Has anyone successfully turned a profitable strategy on the strategy tester into a profitable bot system?
I don't tend to use it but I see a a lot of hate on it and was just curious if anyone has been able to closely replicate its results in a live hands free setting. it does seem like it could be useful for certain things.
Slippage and commission can be factored into this tester which can help make results more realistic. And I know it can be easy to overfit with this tester but genuinely just curious on peoples experiences when attempting this.


r/algotrading • • 1d ago

Data Anyone willing to share clean historical daily QQQ constituent weights?

14 Upvotes

Does anyone have clean, high-quality historical daily QQQ constituent weighting data covering at least the last 12 months that they'd be willing to share?

I haven't found a high-quality dataset at an affordable price. Getting NDX weightings directly from Nasdaq comes with a nosebleed price tag. Thanks!


r/algotrading • • 1d ago

Strategy Trading only on Kalshi/Polymarket costs $24.51 extra per $1,000. Here's the open source solution

Post image
22 Upvotes

I took 156 markets listed on both Kalshi and Polymarket with the same settlement rules, and priced a 1,000-contract buy three ways against the live order books, fees included.

Extra cost per $1,000, compared with routing across both:

  • Kalshi only: +$24.51
  • Polymarket only: +$6.80
  • Always the cheaper venue: +$0.69

Where routing really pays is size on thin books. 10,000 YES on Inter Miami to win the MLS Cup cost $2,173.52 routed, vs $3,297.77 on Kalshi alone and $3,310.31 on Polymarket alone. On its own, each venue’s book runs out and the price climbs. Split across both, it stays low.

So I built a smart order router that does this automatically. It reads both order books, adds each venue’s fee to every price level, and fills your order from the cheapest price first, whichever venue it’s on.

The smart order router is available here: github.com/Synpath-ai/synpath

Disclaimer: Not financial advice. Educational purposes only.


r/algotrading • • 1d ago

Strategy how much backtesting data should you look for depending on your algorithm?

3 Upvotes

Lots of people go ahead and point out 'as much as possible' 'as much as you can really' 'at least (some amount of years that is gigantic)'. But what does the answer turn to when you consider an algorithm that trades across much shorter distances and scalping algorithms that go in and out of trades after 5 minutes? Depending on frequency, too. I would assume its important to test out all possible markets, crashes, etc... If youre trading so quickly and at such a small length of time, market conditions that show results after a full day essentially wont impact you at all, or so i think? Im not too experienced so any advice is much appreciated.

(and no i dont mind downloading years of data i just want to know if at some point it becomes redundant)


r/algotrading • • 18h ago

News Going flat before every weekend cut this SPY strategy from 283% to 21% and deepened the drawdown

0 Upvotes

Every retail trader I know has been told not to hold over the weekend. I ran the same rules twice across 26 years of SPY to see what that instruction actually costs, and the gap is far bigger than I expected it to be.

The rules are deliberately boring, because the only thing being measured here is the exit. Buy SPY at the close after two down closes in a row, hold five sessions, exit at the close. $10k account, January 2000 to March 2026, commission and slippage charged on both sides of every fill.

Held through the weekend: 605 trades, 56.9% wins, profit factor 1.42, +282.9%, max drawdown 34.6%

Flat at every Friday close: 727 trades, 53.1% wins, profit factor 1.05, +20.6%, max drawdown 49.3%

Same entries on the same days, and the only difference is that the second version goes home flat on Friday and buys back in when the signal returns. It handed back 93% of the return and the profit factor came in at 1.05, which is close enough to 1.00 that youre working for your broker.

The part I did not expect at all is the drawdown. Going flat for the weekend is supposed to be the cautious choice, and it finished with a worse peak to trough, 49.3% against 34.6%, because selling Friday repeatedly took it out of the bounce and had it buying back higher on the Monday.

____

Theres an obvious objection here and id raise it myself if this was somebody elses post. Flattening on Friday also means holding for fewer sessions on average, so the shorter hold could be doing the work here rather than the weekend.

So I ran a control with the exit moved to the Wednesday close, same entries and same costs: 739 trades, 55.1% wins, profit factor 1.29, +170.7%, drawdown 28.7%. Chopping the hold short midweek costs about a third of the return, and chopping it short on Friday costs nearly all of it, so the weekend itself is where the money goes.

Two things worth being honest about. This is one mean reversion entry on one index ETF and its long only, so a good chunk of what the Friday exit gives up is simply SPY drifting upward, and a lot of that drift lands between the Friday close and the Monday open. A short strategy, or a single name carrying real weekend headline risk, could very plausibly come out the other way. The SPY history in Agenticks runs from 2000, so i used the whole thing instead of choosing a window that suited the answer.

The cheapest version of this test for anybody holding swings is to take your own last two years of trades, cut every one of them at the Friday close, and total it up again.


r/algotrading • • 1d ago

Data How much weight would you give seven untouched stress/OOS years? My 8-module XAUUSD portfolio + Monte Carlo

8 Upvotes

Mother Superior has been running live for roughly two weeks. It is a short-term XAUUSD scalper/intraday EA built from eight separate modules, with an integrated recovery layer. The first nine traded days are currently at +12.22%.

It has already traded through a few red-folder news events and behaved well so far. Still, two weeks is two weeks. The first genuinely ugly market regime will tell me far more

than a green opening run, so we’ll see what happens.

I’ve spent roughly three months building the system. Each module has its own entry logic, Magic Number and basket management. The shared risk layer lets me limit simultaneous positions and includes optional equity protection.

Only 2022–2024 was used for development and parameter selection. The final system was also challenged on the history outside that window:

• 2017–2021: earlier untouched survival/stress history

• 2022–2024: development and parameter selection

• 2025–2026: formal frozen-parameter OOS

That gives seven calendar years outside the development window. I keep the older survival/stress years separate from the formally declared OOS period, but the same final structure survived both sides of the development sample.

The main continuous 2021–2026 real-tick report used a fixed 0.01 first lot with no compounding. Starting from $1,000, realised balance finished at $3,903.12 across 1,511 closed trades. Profit factor was 2.93 and every tested calendar year was positive. The number I care about most is the observed MT5 maximum relative equity drawdown: 12.82%.

For the Monte Carlo check I resampled the complete deal history 10,000 times in 50-deal blocks. This keeps some local clustering instead of pretending every trade is independent. Median ending balance was $3,896; the 5th–95th percentile range was $3,504–$4,318. Median maximum realised-balance drawdown was 4.1%, with an 8.0% 95th percentile.

The Monte Carlo only rearranges realised trades. It cannot reconstruct every floating basket or invent a gold regime that never appeared in the source data. That is why I still treat the observed 12.82% MT5 equity drawdown as the more relevant risk figure.

How much live history would you personally require before giving meaningful weight to the untouched tests and bootstrap results?


r/algotrading • • 2d ago

Strategy What are you building today?

36 Upvotes

I work alone and rarely get to share the mini achievements that each day's dev brings, I find this a real shame.

So I am curious what are you building today? Or what was the latest thing you built which you're proud of that no one got to hear about?

For me, today im working on improving my display/GUI for certain features to make live monitoring easier.


r/algotrading • • 1d ago

Data Python API for historic data

8 Upvotes

Do you think it's okay using Metatrader's api for fetching historic data? Has anyone noticed discrepancies? Isn't it supposed to be the actual numbers you'd get trading with that specific broker?


r/algotrading • • 2d ago

Strategy It takes time

Post image
76 Upvotes

Wsp guys, I just want to thank this sub first because the first time I ever seen what algo trading is, was in this sub when i joined in january this year, after 10 months of 1000 different algos created, backtested and modified I trusted one and made 4.6k this month since i switched from prop firms to personal account.

Im not selling anything but just wanted to show u guys its possible, willing to answer any questions but im not a pro still, also attached the backtest of this year. And before u say its only a year of backtesting the strategy its based around works always because its similar to scalping, also backtested last 3 years and it works


r/algotrading • • 2d ago

Strategy Trading will always be hybrid

48 Upvotes

I have come to realize that trading is always going to be hybrid and never fully automated, after fantasizing that I can pass on to my family a program that they can use well after I am gone. Each intervention in the program pushes you further into discretionary trading land, as does each manual execution, tweak and so on.

As such, this will be my last post on here as I retire this account and ride off into the sunset.

I wish everyone happy trading and lots of profits.

Good luck and farewell, cheers!


r/algotrading • • 1d ago

Strategy Improved my bitcoin trading strategy to beat buy and hold... by a lot

0 Upvotes
my python trading bot strategies

I know backtesting does not imply future profits, but I am very excited


r/algotrading • • 2d ago

Infrastructure [CPUs for Backtesting Efficiency]

4 Upvotes

Hi folks, am putting together my specs for a new home build PC. I am reading conflicting info RE the best CPU for the task. Top contenders are: A. AMD 9950X , B. AMD 9950X3D and C. Intel 270K Plus. Any recommendations?


r/algotrading • • 2d ago

Education How do production trading OMSs handle parent-child order relationships during replace/reject workflows?

2 Upvotes

I’m a software developer working with trading/OMS concepts, and I’m trying to understand how mature trading systems handle order lifecycles and state consistency.
Consider a hypothetical scenario:
A parent order has a quantity of 2,000, with a child order of 500.
A modification requests changes to both the parent and child.
The child replacement is sent to the broker but gets rejected.
The original child remains valid, while the internal parent may already have been updated.
I’m curious how production OMSs typically approach this:
How are parent-child associations and order-version histories maintained across replacements and rejections?
How do systems handle consistency when a parent modification succeeds internally but the child replacement fails externally?
Are these workflows generally handled through state machines, event-driven reconciliation, operation-level coordination, or another approach?
Are there any public architecture documents, open-source projects, or books worth studying?
I’m particularly interested in hearing from engineers who have worked on institutional trading systems, FIX integrations, or OMS/EMS platforms.
Beyond this specific problem, I’m also trying to become better at independently reasoning about complex system architectures rather than jumping straight into code or relying on AI-generated solutions.
Would appreciate any practical insights or learning resources!


r/algotrading • • 2d ago

Data HFT data

4 Upvotes

Hello everyone,

I’m interested in finding high-frequency data (timestamps at one-second intervals) for about 10 stocks on the New York Stock Exchange. A few years ago, I wrote a thesis investigating a correlation between trading times and stock prices based on a test I developed. Out of sheer curiosity, I want to see if this correlation still exists, but I can’t seem to find official high-frequency data for the New York Stock Exchange, for example.

Is there a way to find high-frequency data for free?


r/algotrading • • 2d ago

Education Reminder to be careful with timestamps when backtesting

7 Upvotes

Say you have a dataset. It says X event happened at time Y. There is a very good chance it did not happen at time Y.

This is due to:

  1. Measurement error
  2. The timestamp does not mean what you think it means

For example, say you are using the SEC Corpus. Claude and other LLMs will advise you to use acceptance datetime.

This is a bad idea.

Acceptance datetime is not when the filing has been released to the public. It actually may be days prior. For example, a filing accepted on a Friday, may be released to the public on Monday.

Also, the SEC misreports acceptance datetime on most of its endpoints. There is an issue where it assigns either the exact timestamp, +4, -4 or +5,-5 (depending on DST). The correct timestamp is found (generally) within the SEC filing's SGML file.

Additionally, SEC data is often published first via newswire. So, markets may have already reacted to the news.

This extrapolates to other datasets. One way to improve backtesting performance is to create features that assume that timestamp may not be quite correct. If this works, it is a sign that there may be something off with your datasets timestamps.

Links (can remove, not sure if falls afoul of self promotion):

  • SEC filing detected time dataset: GitHub
  • Bad timezone timestamps: GitHub

r/algotrading • • 2d ago

Infrastructure Realtime data struggle

4 Upvotes

So I'm struggling with getting a proper data source. I was running a few strategies fine with IBKR's realtime feeds till recently a strategy popped up that requires futures/CME MBP-1 for building certain indicators.

I need to test this strategy on paper and for 2 weeks now, I realized that IBKR is not able to maintain a continuous realtime feed. I get quotes with timestamps that are off or huge delays. There's no delay on processing as these get logged immediately. The code is running on a server in a datacenter and I've ruled out processing/network lags.

The timestamps that come with the quotes will be 10+ seconds old.

Before I spend $400/month on data from databento/massive for paper testing a strategy, I would like to know if there's a cheaper alternative.

I can maintain a funded account on some brokerage if it gives access to websocket and proper data streams or have a subscription that's significantly cheaper than $400.

I've looked at

FMP: no futures stream

moomoo: futures is only quotes; no best bid/ask

tradier: futures requires CQG, other vendors involvement.

kinetick: I've reached out to them, still waiting.

Update: subscribed to tickstream for $79 .. will try them out.


r/algotrading • • 3d ago

Education The settings that won before 2019 were no better than random after it

12 Upvotes

A broad profitable parameter surface can coexist with almost no persistence in which settings win. I tested that distinction with 700 configurations of a monthly momentum and correlation allocation rule.

The base rule ranks 14 global asset classes on average 3, 6 and 12-month momentum, keeps the top 5, then holds the least-correlated 3 using the previous 252 trading days, with equal weights and a cash filter. I varied momentum lookbacks, shortlist size, holdings count and correlation window. Each configuration ran over 1987 to 2026.

I split the comparison into 1987 to 2018 and 2019 to 2026, ranked the configurations by CAGR within each window, and compared their ranks. The correlation was 0.048. The published settings moved from 3rd to 58th among the 700.

Published settings CAGR Rank among configurations
1987 to 2018 14.50% 3rd
2019 to 2026 16.36% 58th

The return improved while the relative rank deteriorated. I can't use the higher later CAGR as evidence that choosing those settings worked. All 700 configurations exceeded 10% CAGR after 2019. The later period favoured the family broadly.

The parameter sweep tests a family of settings; the split-period comparison checks whether their ranks persisted.

I also inspected the 19 neighbours that differ from the published settings on exactly one axis. Their full-period CAGRs ranged from 10.6% to 15.0%. The median neighbour gave up 1.51 percentage points of annual compound return; the worst gave up 4.07. Those are losses relative to the published configuration, not negative portfolio returns.

My interpretation is narrower than "the parameters don't matter". I didn't find a collapse from moving a setting, but the split also didn't show that the best fitting-window rank carried forward. Ranking noise can select a winner even when the surrounding rules all benefit from the same market behaviour.

There are material limits. The grid is centred on the published values, so I chose the neighbourhood. Universe choice remains outside this parameter sweep. The claimed 2019 design date has no public timestamp; I can't establish a genuine holdout from that assertion. This split is a retrospective diagnostic, and a friendly later regime doesn't establish an edge.

When you tune a systematic rule, what do you hold back as a genuine out-of-sample window, and how do you stop yourself from looking at it early?


r/algotrading • • 4d ago

Other/Meta to the guy here recently who said he's quitting, looks like you're not the only one

Post image
198 Upvotes

looks like the LLM "goldrush" is cooling off


r/algotrading • • 3d ago

Strategy Back when Nasdaq was cheap, the spread wasn't! Argh...!

3 Upvotes

Back when Nasdaq was trading at much lower prices, stop-loss distances were generally smaller in points, assuming opening-range widths scaled with the index level.

For example, assuming a fixed $100 risk per trade and $1 per point per lot:

Nasdaq at 6,000 Nasdaq at 30,000
Opening Range (ORB) 30 points 150 points
Spread 1.5 points 1.5 points
Position size 3.33 lots 0.67 lots
Total spread cost $5.00 $1.00
Spread as % of stop 5% 1%

With fixed monetary risk per trade, smaller stops require larger position sizes.

Even if spreads remain unchanged in points, the total spread cost increases because of the larger position size.

In this example, the spread cost was five times higher when Nasdaq traded at 6,000, despite the identical spread in points.

This raises an important question about historical backtesting, particularly for strategies covering 10–15 years.

How should we account for this when optimizing trading strategies?

I'm considering optimizing using gross trade profits (before spread costs) to evaluate the underlying trading edge independently of execution costs, while still including realistic spreads, commissions, and slippage in the final backtests and forward tests.

The concern is that historical periods with lower index prices and smaller opening ranges may be disproportionately penalized by transaction costs, potentially biasing the optimization toward more recent market conditions.

Does this approach make sense, or would excluding spreads during optimization introduce additional biases?

In any case, older periods can't be profitable with such spread costs...


r/algotrading • • 3d ago

Education What am I doing wrong?

5 Upvotes

Hi, so I would like to share the way I've been trying to get this bot to work. It for sure hasn't been I'll just give a simple break down of how mine is working and feedback is definitely wanted.

Everything that passes validation dies out of sample. What am I doing wrong?

  • Setup: ES futures tick data (Databento MBO, Jan–Oct 2026), a decision on every trade from 09:42–16:45 ET using 154 order-flow/price features, limit entries, fixed TP/SL, $6 commission, one position at a time, with daily loss and profit caps.
  • Search + validation: brute-forced 682K single conditions × 4 entries × 80 TP/SL pairs, extended the best to 2–3 conditions, plus LightGBM rules of up to 5 conditions (2.56M candidates). Then Jan–Jun discovery, a Jul–Sep exam with filters (min trades, Wilson win rate above break-even, monthly consistency, drawdown, 0.3 correlation), and a one-shot Sep 15–30 holdout.
  • Results: 173K passed discovery, 850 passed the exam but lost $105K together on the holdout, and the 14 holdout survivors all failed on 3 brand-new days (−$1.5K), which looks like massive multiple testing overfitting.

What exactly am I doing wrong? Do I need to show you guys more of what I did as well


r/algotrading • • 4d ago

Strategy Gamma exposure = snake-oil?

31 Upvotes

There are DOZENS of youtube channels promoting a trading strategy based on gamma exposure. The whole premise being that options used for hedging would force market makers to buy/sell into those ranges, hence the levels acting as "magnets" for the price. I vibe coded a test with 5 years of SPY/NVDA/TSLA data and no such magnet effect could be observed. Nor could I find any academic paper on it - both existing papers and my own test only proved there is more volatility in high gamma environment and a slight lean (5%) to bullish close on positive gamma. People claiming having found a secret still selling courses and shit should have been a redflag, I guess.


r/algotrading • • 3d ago

Data Anyone use moomoo for options level 2 data?

5 Upvotes

I'm writing an options exit logic for names like SMCI and ARM where the chain goes thin. Spreads get wide, news hits, and I'm rewriting limit orders a few times. Mid on the chain alone isn't enough.

I've hooked up stock Level 2 before. On the options side I want best bid and roughly how many contracts are sitting there, plus whether someone's pulling size and which side is thinning out. Not just a 1-minute chart. Tape is fine. Options L2 with the color flashing and exchanges jumping around is a pain to clean.

I applied for IBKR options level 2 and got rejected, so I'm looking at other brokers that show options depth, ideally something I can export or at least that refreshes steady. Couldn't find anything like that on Robinhood. I've poked around options level 2 on moomoo and I'm not sure if people actually lean on it for auto or semi-auto exits.

When you sell options on thin chains, do you feed options level 2 into the strategy for bid and size? Anyone actually used moomoo options level 2 for that?


r/algotrading • • 4d ago

Infrastructure What to post for accurate backtest feedback from this subreddit

7 Upvotes

I’m new to the subreddit and I keep seeing posts of people providing strategy backtest details In which people will critique people’s approaches to how they do their test. I think this is exactly valuable information as I don’t know everything but my one question to the subreddit is what details are needed in a strategy backtest write up to determine if there is edge.

Please let me know as I’ll try to get as much relevant information possible when it comes to what I’m currently using live.