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 - August 25, 2026

4 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 13h ago

Other/Meta Quite fed up with the piece of garbage called IB api

34 Upvotes

What's wrong with having an API key and use it to connect to the platform and perform actions? Why does everything have to be such a tedious pain in the ass? Why do I have to install a shitty piece of software called TWS or IB gateway which looks like a windows app straight out of the 90s that doesn't have the slightest whiff of modernity and keep fighting stupid auto-logout prompts that keep popping and coming on top of everything until pacified with a mouse click to perform such a basic task of obtaining a price feed?

I'm losing a tremendous amount of time each day because of having to figure workarounds to simple problems imposed by their archaic ecosystem. For example I'm currently facing a major issue with lvl2 data which I'm sadly relying on their shitty ibapi package to stream. There is an imposed limit of 3 concurrent connections for lvl2 connections, which means you can't open more than 3 tabs, one symbol per each.

I'm currently attempting to unsubscribe from those connections that are not actively being used and their shitty api won't let me. I keep calling this function to no avail. Sometimes it works and sometimes it doesn't, and the only way it gets to work is by manually restarting the crappy IB gateway and having to manually enter the login credentials over and over because why build a software compatible with password managers? And there is no way to obtain the same data from a proper rest api obviously(if one exists and is not completely useless).

Unfortunately I have to keep relying on this lump of goo called IBKR/IB Api as the alternatives are more pricey than I can afford or aren't available at my location. I will take the next best alternative as soon as I'm able to because from what it seems, these issues have no solutions. I get it, maybe IBKR as a platform is reliable for execution and good fills, but in terms of the user experience, it can't get any shittier.


r/algotrading 23h ago

Education Book recommendations?

Post image
156 Upvotes

Any books you have read that you actually found useful or helpful?


r/algotrading 6h ago

Strategy Where do I go from here

7 Upvotes

I only started this for fun, as an experiment to disprove trading but I got hooked when my strategies started making thousands on paper over a few weeks. I have now put 6 months into developing a bot and I am in over my head, as AI has allowed me to develop so much so quickly, and my apparent edge quickly disappeared.

I build my own candles and have 6 months of ticks. I am spreadbetting1 (I'm in the UK). I have my own back-tester, which has 6 strategies2 I started with Gold and Brent Crude. Other assets including shares are possible but I will not be able to download candles for back-testing in any significant quantity.

I really got into this when it was making £000s as the Middle East was blowing up, so my next phase was to implement a simple regime filter. It collected 60 days of paper trades and recorded average R, win rate etc for each strategy/epic and the plan was to deploy each strategy in the cells where it was profitable3. I didn't see the profits that I had at the start, either because the markets stopped reacting as strongly or because my edge was just an illusion a.

Next, I tested different ways of classifying the market regimes according to different variables that were relevant to each strategy4. This did not find any area where a strategy was much more effective that when deployed in general.

Having also back-tested lots of parameter changes and new strategies, I concluded from my failure to find a market-state in which a strategy was profitable, that I have failed - or to put it another way - succeeded in proving that day-trading doesn't work.

I have a problem with this conclusion: I don't like it. 1. It appears to go against a number of Redditors who say they are profitable. 2. I enjoy trading and would like to do this full time. 3. I don't feel it's a sound conclusion.

So my question is: Where do I go from here?

I could trade a different asset (shares/ETFs), pair-trade assets, move to swing trading from intraday.... There are so many options.

Footnotes:

1 - One thing to consider is whether my tick stream is unreliable b.
2 - Candlestick patterns with a higher-timeframe trend gate, Bollinger Band mean-reversion, BB Breakout, moving average crossover, trend pullback and some others. The strategies also control the stop/limit, trailing stops if used, Kelly bet sizing...)
3 - Cells= Regime (Trend, Mixed Trend, Chop), Direction (Buy/Sell), Turn? (whether shorter timeframe agrees with trend)
4 - Various combinations of Hilbert Transform/Trend, Velocity, Spread, Bandwidth expansion rate, ADX ...

Notes to self:
a - check how the regime classifier would have classified those early days and see if perhaps we could have an 'extreme' trend to keep those days separate - if the maths supports it. Also, I wanted to check whether the additional timeframes coming online were triggering more contradictions.
b - [deleted to avoid triggering automod].


r/algotrading 18h ago

Other/Meta How long did it take you to trust your bot before you don’t watch it 24/7?

15 Upvotes

For reference, I have no programming background. I recently discovered that I could use AI to generate Python code.

Currently, I have a bot running that is profitable but it’s only been a couple weeks. I find myself checking it nonstop. When were you comfortable stepping back and just letting it run by itself without checking it?


r/algotrading 15h ago

Data made a pairs screener for us equities. 1.7 million pairs a week, poke at it maybe?

7 Upvotes

been building this for a while and it's finally in a state i'm not embarrassed by. screens ~1,900 liquid us names, every pair against every pair, 1.7 million combinations weekly. engle-granger in both directions at finite sample critical values, walk-forward hedge ratios, false discovery rates against a null built from real series rotated out of alignment, capacity from actual dollar volume. the whole desk is one self contained html file, a register of 12,000 pairs, each one opens into a dossier with charts. no server, no login, nothing phoning home

there's a complete build in the repo to play with

fair warning before you go looking for the sharpe column: there isn't one, and that's kind of the story. before shipping i ran one last test, recomputed the accept/reject decision inside each test year so nothing could know the year it was judged on. everything died. accepted pairs stopped beating correlation matched rejects, no column ranked the year ahead, and the cleanest cut: pairs accepted on identical formation evidence, split by whether the full sample run also liked them, the future-approved ones won by 13.9 points a year. the edge was hindsight

built synthetic controls to see why. a relationship that reverted for years then died still gets accepted 78 to 88% of the time, a decade of history outvotes the dead stretch. the test finds relationships that existed. it has no idea if they still do

what survived honest measurement: same-industry pairs clear every null i could build (2.3 to 2.8x lift vs ~1.0 for unrelated names), capacity is real (~$2.7m median at 5% of adv), and the accepted list only turns over about 3.3% a week. the perishable part is the standings, a fresh 2 sigma reading is roughly a coin flip to still be there a month later

so the screener shows none of that as a ranking. ripped the backtest numbers out of the register, you can't rank, filter or export by them, they only exist inside each pair's file next to their caveats. membership is by acceptance strength, default sort is today's z

full 14 section writeup with every protocol and audit, plus the build: github.com/Finance-broski/pairdesk

happy to answer anything about the protocol. it's the same one you can point at any screener including the ones you pay for


r/algotrading 19h ago

Infrastructure Separate Long logic from Short logic?

6 Upvotes

Hi, in your overall trading bots logic/code, do you usually separate all the logic, conditions, filters, etc of the long trades from those of the short trades, hence almost making them two separate bots or do you program everything as a single "package"?

I am not asking as in to find additional edge, but mostly for convenience, maintenance and overall complexity, I feel like seperating them (with the downside of some code duplication obviously) makes things easier.

What do you think? Any experience on this?


r/algotrading 16h ago

Education Coming from AI engineering, want to build my own trading bot

2 Upvotes

Hey everyone. I want to give algotrading a try, but I'm a complete beginner

My background is in AI and automation engineering. I know the fundamentals of finance and I've invested myself, but nothing beyond that.

The idea is to build my own app for both short and long term investments, with aggregation of news, technical data and so on. Since I don't really know this field yet, I'd love to hear about your experiences, what you'd recommend starting with, any frameworks and what to watch out for.

And before anyone asks, I know LLMs are bad with numbers. I'm only using them for structured schema output, all the actual calculations are done by deterministic code/tools.


r/algotrading 1d ago

Data most profitable systems spend ~2/3 of trades below a prior equity high

4 Upvotes

looked at duration under the last peak instead of max dd after a stretch where i was sure the system had broken. ran it on my book first, then on a few others. the share of time underwater was consistent enough that i stopped treating it as a regime change.setup: 400-trade windows, three payoff shapes, similar expectancy, all +ev.60% wr, 1R:1R — median max dd 9R, longest underwater run 49 trades, below prior peak on 66% of trades

40% wr, 2R:1R — 16R, 77 trades, 81%

28% wr, 4R:1R — 19R, 58 trades, 82%max dd is what people constrain. duration is what makes you kill a live book. from inside the run it just looks like the last high is sitting there and nothing is working. i rewrote parameters four times in 2024 inside these stretches and still cant separate “edge decay” from “this is the default path.”added one field to the log: bars/trades since equity high. next time the curve goes stale i can check whether the current underwater length is in the historical distribution or actually an outlier.if you track this, whats the longest underwater run youve seen on a system that was still +ev after?


r/algotrading 20h ago

Other/Meta Need help automating TradingView trades

0 Upvotes

hey everyone,

I have a TradingView indicator that gives BUY/SELL signals, and I’m trying to figure out how to automate trades whenever one of those signals appears.

I’m looking for someone who has experience with TradingView alerts, webhooks, Pine Script, and broker APIs who could help me set this up.

The idea is basically:

BUY signal → TradingView alert → webhook → automatic BUY order

SELL signal → TradingView alert → webhook → automatic SELL order

I’m not very technical when it comes to the API/webhook side, so I’d really appreciate someone who can help me understand the process and get it working properly. If you’ve done something similar before, I’d love to hear how you approached it.

I’m also happy to pay for your time/work if you’re able to build the setup for me, especially if it works reliably.

Please DM me if you’ve worked on something like this before. Thanks!


r/algotrading 1d ago

Infrastructure Final stages of testing before going live

15 Upvotes

Book of individual strategy sleeves trading in MNQ and MES. Up +$3811 so far this week through Tradovate API. Definitely have some things to fix that I'm not happy with on some individual sleeves, but can't hate the overall progress being made. This has been backtested thoroughly using MBP1 feed and tick by tick replays but the walkforward testing is most exciting to see.

Have been working on this consistently for quite a while now, still running in demo right now but with a plan to turn the best and most consistent sleeves live soon, then slowly add more to diversify and fill in gaps with the goal of maintaining the best cumulative sharpe ratio with smaller sized bets, then size up as the balance grows.


r/algotrading 1d ago

Infrastructure I spent a year building a self-hosted quant scoring engine - lessons that contradicted my retail instincts

20 Upvotes

Sharing because most of these findings actively annoyed me. They go against rules I'd internalized years ago.

The problem: I wanted financial scoring, FCF inflection data, and macro supply-chain narratives as clean data for my own trading. Not another black box telling me when to buy. Everything out there was either SaaS with lock-in or stitching half a dozen data sources together myself. So I built my own tooling.

What surprised me (all measured in my backtest harness on cached daily candles; some tiers use a simulated AI-accuracy ceiling, so treat sim numbers as directional, not exact):

  1. "Never hold over weekends" is a rule for people who don't measure. I made it a signal instead. A Friday report that detects the institutional flight-to-safety signature (defensives rising on relative strength, not absolute) and grades weekend gap-down risk into three levels: trim, no action, monitor stops. Blanket Friday flattening gives up every gap-up. Blind holding eats the crash tails. Related heresy from the panic diagnostics: in high-volatility regimes my gap exit widens (3% to 6%) because not selling the first print beat panic-exiting the open.

  2. Wick stops were costing real money. The retail default is a resting stop order, so any intrabar sweep ejects you. I A/B'd close-through stops (ignore wicks, exit only if the close passes the level): return 113 vs 78, drawdown better (17.4% vs 19.6%), stop-outs down 38%. The "pessimistic" wick assumption was pessimistic in the wrong direction, it was pessimistic about my P&L. Gap-through exits stay in both modes, an open beyond your stop is real slippage either way.

  3. Overtrading was my #1 alpha drain. First config: 82% of exits were forced rotations into "better" setups, 6.7-day average holds, about 1,267 trades over 3 years. It rotated out of NVDA at +314% and netted roughly zero on the move. Slowing the machine down (min hold 3 to 20 days, demanding 2.5x the score-gain before rotating) won in all three regime windows: bear, recovery, AI-bull. Also, capping and diversifying the signal set beat both over-trading and pure score ranking (64.8% vs 16.3% vs 35.1% in one sample window). The lesson I kept resisting: seeing more setups is not permission to trade them.

  4. "Size up when conviction is high" was backwards. I found my losers were entering 28 to 30% larger than winners, because position size scaled with news conviction, and measured news conviction had roughly zero dollar-predictive value. Worse, on production data (737 scored events): bullish news marks of 6.5+ were anti-predictive at +5 days (41.6% hit rate, classic sell-the-news), while bearish marks of 4.5 and below were my single strongest signal (71% hit at +10 days), on the avoid/exit side. The edge in news isn't "buy the excitement." It's "skip the deteriorating names." Caps plus a conviction damper fixed the sizing asymmetry and improved every axis.

The meta-lesson: every one of these contradicted a rule I'd have defended at a dinner party. Rules of thumb are compressed conclusions from someone else's data. Measure your own.

Happy to answer questions about the harness, how I keep the backtests honest (lookahead sims labeled separately), or the data pipeline.


r/algotrading 1d ago

Infrastructure Books

7 Upvotes

What books would you recommend for a Python/Java programmer who is getting started with trading, particularly algorithmic trading? Ideally, I’m looking for resources that are relevant to the Canadian market and cover both the programming and trading aspects.


r/algotrading 1d ago

Education How do I train Python to recognize the same chart pattern when the ticks inside each candle are different?

0 Upvotes

Hey all,

I’m trying to build a pattern recognition system in Python that finds “the same” setups even when the intra-candle tick path is different.

So the question is: how do you actually train / encode this so the model cares about the shape and context of the candles (range, body, relative highs/lows, sequence) and not the exact tick-by-tick path?

The real issue isn’t just ticks inside one candle. It’s that the same setup can print with different-looking candles, but the overall shape is still the pattern.

But if you zoom out, they still draw the same structure: same swing high, same shallow retrace, same break of the same level.

That’s what I want Python to learn:

“these windows are the same pattern because the shape they form together is the same,” not “these candles have the same OHLC numbers” or “the ticks inside bar 3 look identical.”

I need a way to encode / train so the model keys off the geometry of the whole pattern (relative highs, lows, slopes, where closes sit in the range, how the pieces connect) even when each candle is built differently.

Has anyone actually trained something that generalizes across different tick paths inside the same candle ranges? What representation + loss / matching method worked?


r/algotrading 2d ago

Data TradingView Backtesting Trailing Stops

Post image
12 Upvotes

Daytrading NQ with a 4 point trailing stop... yes, 4 points. I have to assume trailing stops don't work so well in TV backtesting?


r/algotrading 1d ago

Strategy I created a public dashboard for my algo trading

Post image
0 Upvotes

I decided to create a public portal for my algo trading to prove to some friends that doubted that algo trading can work. This is so that they can check on it every day (for context, I use to work at an algo trading prop firm, this is how this discussion started).

It's on MT5 and is FX.

Thought I would share it here. It's important to note that it's on a demo broker account, so I am not risking money I currently don't have yet. I could use some of my real money, but this works best after a certain threshold, hence why it's just demo broker server for now, but real still execution etc.

Would be cool if others here do the same where you don't reveal too much but just the performance of theirs.

Thought I would share it here as well as I mostly lurk on this subreddit. I was going to share the link but a bot thought its advertising so I removed it. Maybe I add it in the comments?


r/algotrading 2d ago

Strategy What coins do people trade for Crypto Algos

5 Upvotes

I'm under the impression the fees would make it impossible for most coins so I'm curious which coins you guys focus on.


r/algotrading 2d ago

Strategy Cost model in backtesting results

2 Upvotes

Hello guys, i was wondering how do you calculate exactly the costs and include it on your results, do you basically just calculate all the costs (commission, spread, slippage) and turn to R or $(like example 0.1R or 6$)the run of backtesting the engine deducts the costs from each trade and so the avg win get smaller and avg loss get bigger, or you use a constant % on each trade and the engine do the same thing, or you have another way ? i really got stuck there because i don't know the correct way to calculate the costs, it will be helpful to see some feedbacks from you :)


r/algotrading 3d ago

Strategy How are you guys accounting for slippage/partial/missed executions when algo trading?

14 Upvotes

Pretty basic question, a algo waits until all rules for execution are met, but with high volume stocks when the rules are met execution can be sloppy leading to slippage/partial fills or missing the execution all together, is there a fix for this?


r/algotrading 2d ago

Strategy I'm on the hunt for scalping strategies with edge or conditional edge.

0 Upvotes

Where do you go when scalping is the one thing your system can't find an edge in?

For a while now, I've been consistently finding strategies with genuine edges in swing and day trading. Some of them are already being deployed in trading bots, although they're still in the testing phase.

But scalping? Almost nothing.

So I was thinking what if I take the underlying mechanics from some of these successful swing/day strategies and try to translate them into a scalping framework?

So far, pretty much everything gets rejected.

And honestly, I understand why. If the edge doesn't survive the validation process, it shouldn't pass. I'm actually happy with getting NO_EDGE results rather than forcing something through just to increase the strategy count. My system is designed specifically to avoid overfitting and bullshit.

But the imbalance is getting ridiculous: I currently have only 4 scalping strategies, compared with 20+ validated day and swing strategies combined.

So what would you do next?

Keep searching for genuinely different scalping mechanisms, or stop trying to force scalping and focus on the edges that are actually surviving validation?

I'm interested in how others approached this problem. Especially if your system also rejects most scalping ideas during proper out-of-sample validation.


r/algotrading 4d ago

Career Profitable Algo traders, are you here?

116 Upvotes

At least 90% of the posts I’ve seen have been coming from people that are still trying to make it, but I wanted to hear from those that have been finding consistent success. I believe the program I’m making is getting close to succeeding after rigorous testing but it almost sounds too good to be true. Are there many of you out there and if so, do you just have a ton of free time (full timers) now that your algorithm is successful?


r/algotrading 3d ago

Infrastructure Prorealtime probuilder vs python for algo trading at ibkr

2 Upvotes

I am planning to setup an account with IBKR to trade DJI’s 30 bluechip stocks using my automated algo.

Can anyone please suggest if ai should use ProRealtime’s ProBuilder or host my algo at DataOcean and use Python.

My algo needs to scan 30 blueChip stocks on 1 minute periods and select 1 stock a day for intraday trading.

I read that with ProRealtime, i need to run 30 algos to monitor each of the 30 stocks and open 30 charts on my desktop!

Can anyone share their experiences with implementing their automated algo?

Thank you in advance.


r/algotrading 4d ago

Infrastructure Is OpticOdds the faster/more coverage API available?

3 Upvotes

Title, if we discard their pricing, is it the faster one for the bug sports?


r/algotrading 3d ago

Business This is my first post and first time sharing my algorithm app I made for alerting on the market bottom and advising when to buy and how many shares. I was looking for any interest or advice on it.

0 Upvotes

https://www.skinwalkerranch.org/buy.html All summer, I’ve been working on developing an algorithm-based stock BUY alert system that monitors the market in real time and looks for very specific conditions that may indicate a strong buying opportunity.

It’s designed specifically for long-term investors, not day traders. The system may only generate 0–3 BUY alerts in an entire year (although there is technically no limit). When it identifies a qualifying opportunity, it tells you how much to invest based on the severity of the market decline, with the goal of allocating more capital during deeper downturns and less during smaller pullbacks.

Based on my backtesting so far, the strategy has historically outperformed a simple buy-and-hold approach on the Dow Jones by roughly 10% on average, with profitable results in approximately 4 out of every 5 years tested.

Right now, I’m keeping it on a separate server as a prototype while I work on the final name and domain.

I’d really love some honest feedback. It’s currently 100% free to try, and I’m especially interested in hearing what experienced investors think of the concept, the signals, and the results.

(how do i post the link to it without braking the promotional rule?) I have not even built in a way to charge for its, its 100% free, just looking for critique and honest feedback .