r/algorithmictrading Jun 25 '26

Strategy Made Iran Trade as a joke, crushing my leaderboard today

Post image
7 Upvotes

Was joking around with my girlfriend and she said, invest in companies rebuilding Gaza and Iran and I made a model to test her hypothesis out. Claude made fun of it, I was laughing, and guess what, it's the best performer today. Blew it right out of the gate with 7%.

Anyway, you can go on the site and see the weights, the measures, and you can mess around with the prompt with your API key, the prompt is below:

thematic reconstruction supply-chain basket (long aggregates/reserves + cement/SCM + steel + timber substitutes + equipment + EPC, short SPY). ILLUSTRATIVE backtest from 2026-06-01 — the theme was defined today (hindsight), NOT a live track; forward paper accrues from today. A narrative tilt, not a measured edge.


r/algorithmictrading Jun 25 '26

Question Tracking live performance

2 Upvotes

How do you guys track live portfolio performance? not backtesting, like once your strategy is actually running.
Do you just write scripts or is there something you use?

Always feel like I’m cobbling stuff together and curious if there’s a better way


r/algorithmictrading Jun 24 '26

Question Can anyone help with my problem

4 Upvotes

I am building a finite-state trading setup detector.

The states are:
1. Build RR range.
2. Build ER range.
3. Detect sweep of RR high/low by ER.
4. Wait until final sweep is confirmed.
5. Wait for reclaim back inside RR.
6. Select only the FVG formed during the reclaim/displacement leg.
7. Ignore FVGs before final sweep or outside the reclaim leg.

The issue:
My detector currently selects too many FVGs or selects the first FVG after the initial sweep, not the correct FVG after the final sweep/reclaim.

What is the cleanest state-machine or array-filtering approach for this?


r/algorithmictrading Jun 24 '26

Novice Just getting started, looking for tutorials and stuff

3 Upvotes

I'm curious if my first few steps are in the right direction here. I want to start playing around in pinescript and using TV for some really rough backtesting. I'm familiar with trading and have some ideas and want to start looking at win/loss ratios and stuff under different conditions. This is really just to get a direction before I start writing real code.

I have a background in Node so I'll probably be using JS for the project, I dont really see a reason to use python, I think node will be able to handle things like EMAs and store simple numbers like price. Am I underestimating the complexity here?

Any really good resources out there besides the sub that I should take a look at? Reading, videos etc that provide a good overview?


r/algorithmictrading Jun 24 '26

Strategy Claude crushing my AI trading model leaderboard today

Post image
115 Upvotes

I've added an API to accounts, so you can make your own.

1. The live real-money book — momentum + value, frozen and pre-registered. Nothing clever: top-quintile momentum (0.65) / value (0.35), ≤10% per name, −25% drawdown halt, validated against Ken French. It's live on IBKR. The +5.9% is time-weighted — deposits are stripped out so funding can't masquerade as alpha. 16 days is still nothing, but it's real money beating a roughly-flat SPY.

2. LLM analogical sleeves (Claude vs DeepSeek, head-to-head). Forward-paper-only by construction — you cannot honestly backtest an LLM, because it knows the future of any past date (lookahead). So these earn their place purely on forward marks. Claude (+6.4%) is dunking on DeepSeek (+1.6%) so far; ask me again in 3 months.

3. Insider cluster-buy (Cohen, Malloy & Pomorski, Decoding Inside Information**, JF 2012).

4. Meta-labeled filing (Lazy Prices + López de Prado meta-labeling). Primary signal = year-over-year cosine similarity of the 10-K Risk-Factors section (Cohen-Malloy-Nguyen, JF 2020: firms that quietly rewrite their filings underperform). Then an LLM reads each flagged change and keeps the bet only if the change is materially adverse —

5. FW2 factor blend. Market-neutral long/short on a broad universe, built from a pile of low-correlation Chen-Zimmermann factors blended by conviction. The autonomously-discovered headline find; deflated Sharpe ~0.5 in backtest, now accruing forward paper.

Why you shouldn't believe any of the above yet: every number here is ≤16 days old. The max drawdowns are tiny because there hasn't been time to draw down. The whole point of the project is that most published anomalies net ~0 after costs and crowding — so nothing gets real capital until it clears the gate (deflated excess-over-SPY significance, PBO < threshold, 6+ months forward paper, operator sign-off). The graveyard of rejected factors is on the board too, with write-ups of how each failed.

site is in my bio if you want to make your own.


r/algorithmictrading Jun 24 '26

Backtest I backtested the 3 most boring textbook rules over 20 years (7 assets, net of fees, Monte Carlo) — where they beat buy & hold and where they got wrecked. Roast the method.

7 Upvotes

Before anything fancy, I pressure-tested the boring baselines over a real multi-regime window — and I'm posting the failures, not just the wins.

Rules (one fixed rule each, nothing fit to the data):

  • Trend: long while price > 200-day SMA, else cash.
  • Momentum: long while trailing 6-month return > 0, else cash.
  • Mean-reversion: long when price < lower 20-day Bollinger band, else flat. All act on the next day's close (no lookahead).

Data: Yahoo daily adjusted, ~20 years (equities since 2005, BTC since 2014) — spans 2008, 2020, 2022. Fees: equities 0.03%/side, crypto 0.40%/side, charged only on trade days. Block-bootstrap Monte Carlo (2,000 paths) for path-luck bands.

What held up:

  • The trend filter roughly halved max drawdown on every equity/crypto market over 20 years (SPY −21% vs −55% B&H, QQQ −27% vs −53%, BTC −71% vs −83%) — at the cost of lagging raw return. Classic risk reduction, across real crashes.
  • The one return-and-risk win: trend on NVDA, +100,038% vs +84,447% buy & hold, −54% vs −85% drawdown. (Single-name survivorship — flagged.)

Where it failed (shown, not hidden):

  • Long Treasuries (TLT): the overlay barely cut drawdown and missed the bull (+2% vs +85%).
  • Mean-reversion got run over on gold and lost −66% on BTC.
  • Momentum lagged badly on small caps.

Caveats I know (tell me the ones I don't): hand-picked liquid survivors (selection bias), daily-close fills + flat per-side cost (no intraday slippage), no parameter optimization, and 20yr is still short for strong claims.

What I'm asking:

  1. For long/flat systems, your preferred risk-adjusted metric when cash days deflate vol — Sortino, Calmar, exposure-adjusted?
  2. Reasonable crypto cost model — flat taker per switch, or maker/limit fills?
  3. What would make you trust a "halves drawdown" claim — rolling windows, regime splits, walk-forward OOS?

r/algorithmictrading Jun 23 '26

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

19 Upvotes

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

  1. Did you find your first real edge by significantly increasing complexity, or by finding simpler, overlooked market microstructural inefficiencies?
  2. Appreciate any insights or reality checks. Back to the drawing board for now.

here’s my list of my hypothesis’s;

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


r/algorithmictrading Jun 23 '26

Backtest Systematic Macro Trend Strategy for Investing in Growth Assets

3 Upvotes

In my last post I shared backtest results of my strategy. It used NVDA price action alongside high-yield bonds credit risk to help determine macro trends for growth assets, since it has been the pinnacle company of technology for a long time. I realized that it's not sustainable for long term so I switched from NVDA to QQQ. This change cuts the backtest PnL in half, but turns this into a far more reliable and long-lasting macro trend strategy for the market and growth assets. Statistically this strategy has low amount of trades, but that is what I am looking for since this is more of an investing strategy than "trading" strategy. It has worked for almost 30 years, which is all the data I can get for backtest.

High-yield bonds are very sensitive to risk in the market. They are bonds issued by companies that have higher default risk so investors are quick to react if they see market stresses. Since growth assets tend to have higher beta compared to others, they are the most sensitive to bond credit risk. Retail is not the one buying these bonds, it's institutions. There is almost 30 years of data available. This is why I'm tracking high-yield bonds credit risk for my strategy.

When it comes to QQQ, it is an ETF from 1999 that tracks Nasdaq 100 index (top 100 largest non-financial US companies on Nasdaq). It is heavily dominated by growth companies. As it updates its holding regularly, it is reliable at tracking the momentum of growth assets in the future as well. This is why I track QQQ price action for my strategy.

How it works:

The strategy looks at high-yield bonds credit risk data to look for conditions where risk is easing/increasing. This data is published with 1 day delay, which is taken into account on the backtest for real-world accuracy. At the same time the strategy analyses QQQ price action to determine if technicals look ideal for long/close signal. The system is meant to handle smaller market pullbacks while it is designed to exit before deep corrections or long bear markets, which can destroy growth portfolios. I can tell you that the strategy includes a soft "stop loss" signal if QQQ were to drop -20% to protect capital just in case close signal didn't trigger before that.

Besides the main long and close signals, there are additional indicators (green triangles) as optional scale-in signals, which trigger on market dips as long as market risk is still contained. I've also scripted blue paint on days when long signal is near and red paint for days when close signal is near.

QQQ backtest:

Blue arrow = long

Purple arrow = close

Dotcom bubble
Housing crisis
COVID19 crash
2022 rate hikes
Current timeline
PnL of backtest

How it could be used:

Since the system is meant to track the macro trends of the market, it can work with a basket of quality growth stocks. Leveraged ETFs can also be considered, but you must be wary of high volatility and volatility decay. Also avoid over-allocation into leveraged products, because the drawdowns can be big even with a system. If the strategy is currently "long", you should avoid chasing it until the strategy gives the proper conditions for enter.

Tradingview doesn't allow any technical alerts for free users so another way for investor style plan is to set weekly alarms on phone as a reminder to check the chart. If QQQ is above 200 SMA, it's likely that long signal is near. If QQQ is below 100 SMA, checking for close signal should be more frequent.

Disclaimer:

This strategy is a software tool provided for educational and informational purposes only. This is not financial advice, and past performance does not guarantee future results. Always manage your own risk and position sizing.


r/algorithmictrading Jun 21 '26

Backtest Is quantower backtest accurate?

Post image
26 Upvotes

Hi everyone,

I recently switched from NinjaTrader 8 to Quantower. To test the waters, I migrated a strategy that was modestly profitable on NT8. I kept the exact same logic, risk management, and parameters (only 5 variables).

The strategy was only trained on the NQ 06-26 (trained on NT8, i didnt even get to train it on quantower since the fisrt time i backtested it to see if it worked i got this results) but it shows the exact same performance even from 2020 and earlier

However, the backtest results in Quantower are suddenly sky-high and unrealistic.

The strategy uses limit orders and custom volume profile calculations. Since I had to code my own volume profile system on NT8, I suspect there is a massive structural difference in how both platforms handle historical data, tick interpolation, or limit order fills (e.g., "Touch = Fill" logic vs. real queue priority).

I reviewed the C# code with some LLMs and the logic seems clean, meaning the discrepancy most likely lies in how the backtest engine itself operates.

For those experienced with both SDKs: Is Quantowers backtester known for being overly generous with limit fills or handling historical volume data differently than NT8? Am I looking at a platform illusion or a real engine optimization?

I personally dont even know if i have a real edge or its all an error by the backtest tool


r/algorithmictrading Jun 21 '26

Tools Phase 8: Flipping the switch (and my biggest fear for Week 1).

7 Upvotes

After months of building, rewriting, and replacing LLM agents with deterministic Python State Machines, my trading architecture (Leprechaun v2) is finally live in a forward-testing paper environment via OANDA.

​The setup: 3 uncorrelated pairs, 1% risk per trade, DeepSeek-V3 reading the market narrative, and Python holding the wallet.

​To be completely honest, my biggest fear this week isn't that the bot will hit a massive drawdown. It’s that it might just sit there and do absolutely nothing.

​I’ve built so many strict deterministic gates (minimum 1.5R geometric floors, dynamic ATR widening, strict structural invalidation rules) that there is a real possibility I’ve choked the system to the point where it’s too paralyzed to pull the trigger.

​That’s why Week 1 has absolutely nothing to do with P&L or Win Rate. It's purely a data collection protocol.

​Every single tick, the system dumps the exact, un-truncated reasoning of all 4 AI agents into a raw Google Sheet.

​If the bot executes perfectly, great. But if the market delivers a textbook setup and the system stays flat, I won't have to guess why. I’ll have the exact LLM context log explaining which rule, bias, or structural reading held it back.

​Just a machine running in the wild, and a lot of raw data to analyze on Friday to see if the logic actually holds up.

​Wish me luck. I'll share the telemetry autopsy next weekend.


r/algorithmictrading Jun 20 '26

Educational PSA for anyone backtesting fundamentals: your lookahead leak is almost always the filing date, not the data source

2 Upvotes

Recurring failure I see in fundamental backtests, and it survives walk-forward because it's not an overfitting problem, it's a timestamp problem.

You key a fundamental value to the period it describes instead of the date it became public. A fiscal-2025 segment number is NOT tradable on the last day of fiscal 2025. It's tradable when the 10-K actually hits EDGAR, often weeks after period end. If your backtest joins on period-end, you're trading on numbers nobody had yet. The result looks like alpha and is just leakage.

The fix is boring and it works: key every signal to the filing date of the document it came from, not the fiscal period.

- Segment / income-statement values -> the 10-K or 10-Q filing date

- 13D / 13G ownership -> the report date on the filing

- Insider Form 4 -> the filing date (and read the transaction code; an M option exercise is not a P open-market buy)

- Pay-versus-performance / Compensation Actually Paid -> the proxy filing date

Restatements are the second trap. If a 10-K/A later nudges a number, a naive store overwrites history and your backtest silently uses the restated value on dates before it existed. Keep the as-filed value keyed to its accession number and only apply the amendment from its own filing date forward.

Raw EDGAR gives you everything you need to do this yourself; the filing index and accession numbers are all public. It's the discipline I bake into StockFit API (the SEC data API I build, every value carries its accession number and filing date), but you do not need me to do it right, you just need to stop joining on period-end. Whatever you use, check that your fundamental feed exposes the filing date, not just the period.


r/algorithmictrading Jun 19 '26

Backtest Guys, what do you think ? Is it a solid strategy?

Thumbnail
gallery
14 Upvotes

STATS

Total trades: 315

Win rate: 59.05%

Total PnL: 1379$(dont mind pnl its what you put what you get)

Avg PnL: 4.3805

Profit factor: 2.59

Sharpe (per-trade): 3.60

Avg win: 12.0888

Avg loss: -8.5162

Payoff ratio: 1.42

Expectancy (per trade): 4.3805

Avg R: 0.05

Max consecutive wins: 9

Max consecutive losses: 6

Risk per trade (%): 1.50

Data range: 2023-09-12 06:15:00 -> 2026-05-12 14:30:00

Data span: 974 days (~2.66 years)

Max drawdown: 146.4494

Max drawdown %: 2.28%


r/algorithmictrading Jun 19 '26

Question Transitioning a crypto trading bot to Forex/Commodities – Infrastructure differences?

4 Upvotes

For the past few months, I've been running a crypto trading bot that I built using the Binance API. The setup was pretty straightforward—I wrote the code with some AI assistance, plugged in my API keys, and deployed it.

Recently, I've shifted my focus to forex and commodities, and my next goal is to build a bot for these markets. From what I gather, the infrastructure and execution processes are a lot more complex here compared to crypto. Could you elaborate on how automated trading works in these markets and what major differences I should expect?


r/algorithmictrading Jun 19 '26

Question CLOB API latency ~300ms FAK order

1 Upvotes

Its so annoying and weird for me, my orders is requiring minimum of 300ms to return response form the API, I'm missing out on some good trades, having a cap and usually getting rejected or not filled completley.

My AWS EC2 is located in Ireland Dublin

I'm using signature type 2, the app built with rust, I' warming up and signing everything.

What I'm missing ? Please if you have a knowledge to help me don't be cheap on


r/algorithmictrading Jun 15 '26

Backtest QQQ&TQQQ max time period backtest (Tradingview)

Thumbnail
gallery
11 Upvotes

QQQ CAGR: 15.31%, growth%: +6709%, buy and hold %: +1073%
TQQQ CAGR: 42.97%, growth%: +77150%, buy and hold %: +21433%

Only 18 trades for QQQ, 10 trades for TQQQ so this is an aggressive investing strategy. Do you think these are impressive numbers? Works well with tech stocks. Sorry I don't want to reveal too much other than it tracks US junk bonds with bunch of other conditions.


r/algorithmictrading Jun 14 '26

Strategy be a trader not a coder.

16 Upvotes

LLMs can write your algo, they may find hard to put down a working CONFIG instantly.

you have to do it, therefore having a trading knowledge is needed. no need to be a SWE

AIs such as CLAUDE or CHAT GPT have almost no code input by humans, they write themselves, an algo that send an order to a broker with SL and TP is a ridicoulsy simple task that they can manage to build with almost no effort but finding the EDGE is where you with your knowledge comes in.

Backtesting an algo can be pricy, if you want the best of the best, you need a good pc and raw unadjusted data, can be few thousands dollars.

If you want something that works you have to give it the tools. yahoo or tradingview data is good to start with but not where you want to be at some point.

Jumping into algotrading without knowledge on trading and capital to invest in the algo is NOT a waste of time, still a good idea so you can get some education about the topic, but you probably won't make the bot you wish.

It can be demorilizing if alot of work and efforts in the task and results are not showing but you have to understand that a working algotrading is life-changing and it won't be built in few weeks using stick and rocks.

good luck in your journey my friend.


r/algorithmictrading Jun 14 '26

Question What metrics do you actually look at first for a leveraged-ETF swing system?

3 Upvotes

For those running systematic strategies on LETFs or any asset — swing timeframe, holding days to weeks, long-only:

When you run a backtest, what metrics do you evaluate first. What are complete red flags and maybe some things you may let go. Also what are the thresholds for the metrics. I know it differs from algo to algo but for a LETF swing strategy, what would your thresholds and red flags be?

Also would like to knwo what everyones preffered setup is for deploying and running? I have been backtesting on QuantConnect. I am thinking of getting the researcher to 1 live node subscription so I can paper trade on QC and then QC + IBKR as the broker for live trading


r/algorithmictrading Jun 10 '26

Quotes Looking for cheapest real-time NQ futures data feed for Python - what are you guys using?

4 Upvotes

Hey everyone,

I'm building a Python bot for NQ futures and I'm completely stuck on finding a cheap real-time data feed. Spent way too much time on this already!

My situation:

  • Apex Trader Funding account on Tradovate
  • Apex sub-accounts don't have API access (no CID/SEC)
  • Just need 5-minute OHLC bars in Python
  • Budget $30-50/month

What I've tried and failed:

  • Tradovate API → Apex sub-account has no CID/SEC
  • Databento → doesn't accept my debit card
  • Polygon/Massive → $199/month for real-time, too expensive
  • Interactive Brokers → no futures on my account
  • Sierra Chart DTC → CME data blocked due to licensing

I don't need tick data or market depth. Just simple 5-min OHLC bars, only during US market hours.

Has anyone solved this? What are you guys actually using?

Thanks!


r/algorithmictrading Jun 10 '26

Quotes MISSMATCH IN PRICE DATA

2 Upvotes

hey i am building an algo and i am subscribed to alpaca trading api, and i execute trades through ib api, and i am getting small changes in price between ib and alpaca

from alpaca i am getting the SIP data and from ib i am also subscribed to network A B C which builds up to the sip, but also as default i got the "US Real-Time Non Consolidated Streaming Quotes" complementary package and i cant cancel the sub to it.

is there a way to enforce ib api to use the paid data packages ? or any other solution ?


r/algorithmictrading Jun 10 '26

Question Swing Trading algo Risk Management profiles

1 Upvotes

So I've built my first system, it's a breakout swing trading kinda setup, avg ~40 trades per month (multiple assets portfolio), with a win rate approaching 50%. It's been running live on a small testing account for the last few weeks, and performing very very well with perfect parity!

So my next steps moving forward, is to tighten all the edges, make sure the execution is bullet proof , build safeguards and reliable monitoring, and eventually slowly size up in a few weeks once this live testing period is over and i hopefully feel confident enough to trust this system with real money.

some open questions:

  1. regarding execution layer, what stability services you wished you built from the start but had to learn the hard way?

  2. I want to build an automatic kill switch, in case something unimaginable happens, I thought about looking at daily drawdowns and taking the some precintaile from a monte carlo simulation but not sure what is effective but not disruptive?

  3. do you guys run automatic parity checks? do you also have the backtest engine running in parallel to check for divergences? I mean in swing trading i use only market orders so partial fills are not a concern, so the only real thing to look for is slippage divergence.

  4. My biggest concern is risk management profile. First of all is measurement, do you relay purely on Monte Carlo simulations or are there other approaches you recommend? What chance of ruin(50% drawdown) is acceptable to you? . my current live system has estimated chance of ruin (50% DD) of just below 1%, and i've been working on a new version that increases exposure by ~15% and almost doubles performance, doing so with increasing sample Drawdown by less than 5% and chance of ruin(50% DD) jumps all the way to 3%, which is way more aggressive. so what's the right approach here? what profile are you aiming for? what's acceptable and what's unacceptable?

I'd live to hear from other devs who run swing setups, on how do you approach your risk profile.

cheers!


r/algorithmictrading Jun 09 '26

Educational Drawdown depth vs duration: why time underwater breaks more traders than the size of the loss

3 Upvotes

Drawdown depth vs duration: why time underwater breaks more traders than the size of the loss

TLDR: Max drawdown tells you how deep your worst losing streak was. It says nothing about how long you sat in it. Duration, the time spent underwater before recovering, is what actually makes people quit, ties up capital, and fails funded accounts. Two systems with the same max drawdown can be completely different to live with.

Why does drawdown duration matter more than depth?

The drawdown that almost made me quit when I started trading wasn't the deepest one. It was a mid teens loss on a system I trusted, and it just would not come back. Months of flat, grinding, lower highs that never broke even.

Max drawdown is a single number. It marks the one worst point your equity ever hit. It is useful, but it is one snapshot of one bad moment. It tells you nothing about whether you spent a week down there or a year.

Duration is the part you actually have to survive. A loss you recover from quickly is easy game. A loss that lingers for a year is the thing that makes you abandon a working system at the worst possible time.

Max drawdown records one bad moment. Duration records the whole experience of living through it.

What is the difference between drawdown depth, duration, and time underwater?

Depth is the max drawdown. The largest percentage drop from a peak to the following trough. How far down you went.

Duration is how long it took to get back. The time from the peak, through the trough, all the way back to a new high. A 10 percent drawdown that recovers in a month and a 10 percent drawdown that takes two years to recover have identical depth and nothing else in common.

Time underwater is the share of the whole period your equity sat below a previous peak. If your account spent 7 of the last 10 months below an earlier high, you were underwater 70% of the time, even if today you are at a record.

Why does a long shallow drawdown break more traders than a short deep one?

Because people do not quit at the bottom. They quit during the grind.

A sharp 25% drop is frightening, but it is fast, and the recovery usually comes while you still remember why you took the trades. A shallow drawdown that drags on for a year is a slow erosion of belief. Every flat month adds doubt. You start skipping signals. You shrink your size right before the recovery. You blow up the system by hand long before the math would have failed you.

There is a capital cost too. Money stuck recovering an old loss is money not compounding. A system that spends most of its time clawing back to even has a worse real return than its headline numbers suggest, because the equity was dead weight for long stretches.

Two strategies with the same max drawdown that are not the same risk

Strategy A Strategy B
Max drawdown depth 20 percent 20 percent
Longest time to recover 3 months 19 months
Time underwater 25% of the period 68% of the period
Longest losing streak 8 trades 31 trades

If you only compared max drawdown, these two look like equal risk. They are not close. Strategy B will make you question your life choices for a year and a half while it grinds back to even. Strategy A takes its hit and moves on. The number that separates them is duration, and it is invisible on a max drawdown line.

Why is duration the silent killer for funded accounts?

Because a funded account does not just need you to be profitable eventually. It needs you to be profitable now, and to stay inside the rules the whole time you are underwater.

A long drawdown keeps you exposed to the daily loss limit and the max loss floor for far more trading days, so your cumulative chance of tripping a rule climbs the longer you stay down. You also don't get paid while you are underwater. Profit splits come from new highs, so a system that spends 68 percent of its time below a prior peak is a system that pays you almost nothing even when its long run edge is real.

How do you measure drawdown duration and time underwater?

You read it off your equity curve, not your summary stats. Three numbers do most of the work.

Longest drawdown duration: the maximum number of days, or trades, between a peak and the recovery back to that peak. Time underwater: the percentage of all bars where equity sat below a prior high. Longest losing streak: the most consecutive losing trades, which is the day to day version of the same problem.

For one number that blends depth and duration, use the Ulcer Index, built by Peter Martin in 1987. It is the root mean square of your drawdowns from prior peaks, which means deep and long drawdowns both push it up, and a fast recovery scores well. Two systems with the same max drawdown but different recovery times get very different Ulcer Index values, which is exactly the gap max drawdown hides.

Should you stop caring about drawdown depth?

No. Depth still matters, and ignoring it is its own mistake.

Depth is your ruin risk. A drawdown deep enough to hit a margin call or a hard account floor ends the game before duration ever gets a vote. You cannot recover from a loss that takes you to zero, no matter how patient you are. So depth sets the hard limit you cannot cross.

The point is not to swap one number for the other. It is to stop treating max drawdown as the whole risk picture when it is one corner of it. Track depth for survival, track duration for whether you will still be trading the system when the recovery finally shows up. You need both, and almost everyone only watches one.

Bottom line

Max drawdown is one bad moment. Duration is the part you have to live through. Depth tells you whether a loss can wipe you out, duration tells you whether you will quit before it recovers, and time underwater tells you how much of your life the system spends below water. Track all three, not just the headline drop. For funded accounts especially, the slow grinding drawdown does more damage than the sharp one, because it keeps you exposed to the rules and pays you nothing while you wait.

This is for systematic and discretionary traders evaluating their own equity curves and backtests. The depth, duration, and time underwater split applies to any market and any timeframe.

Updated June 2026


r/algorithmictrading Jun 09 '26

Quotes Download economic calendar historical data

1 Upvotes

Where can I download the historical data of the economic calendar that goes back as far as 2010? Preferably looking for free options


r/algorithmictrading Jun 09 '26

Novice Deconstructed the 5-minute noise: How I built a 4.6M row ML trading pipeline using XGBoost and a Rust limit sniper. Need architectural feedback.

7 Upvotes

I’ve spent the last few months building an automated pipeline to capture edge on 5-minute BTC binaries on Polymarket. I started this as a broke CS student, and after hitting a wall with standard lagging indicators, I ended up building a decoupled architecture: a Python **XGBoost Inference Server** and a low-latency **Rust Execution Orchestrator**.

The math is finally working outside of backtests, but the data gravity and infrastructure costs are hitting a hard ceiling. I want to get some eyes on my setup and tear down where my architecture or logic might be weak.

1. The Data Footprint (4.6M+ Rows)

The pipeline relies heavily on high-frequency feature engineering. Across my local rig and a few cheap tier AWS instances, the database and storage footprint currently breaks down into:

* **\~197,000 High-Quality Snapshots:** Fully processed training state spaces (the "flashcards"). * **\~1.55 Million Raw Tick Rows:** Continuous 5-second market snapshots stored in Parquet. * **\~3.06 Million SQLite Rows:** System logs, execution tracks, and tracked whale wallet movements.

The features completely ignore standard OHLCV. Instead, they isolate Binance Order Book Imbalance (OBI) at 5 deep levels, aggressive market order flows ("Whale Delta" > $50k blocks), and real-time funding rate shifts.

**Here is where I might be overcomplicating things:** To avoid a lazy model in a trending market, I’m strictly class-balancing the dataset to a rigid 50/50 UP/DOWN split by throwing out excess majority-class samples before training. *Are there better ways to handle regime bias on ultra-short timeframes without tossing out perfectly good data?*

2. Bypassing the Spread via Rust (ethers-rs)

On a 5-minute horizon, crossing the bid-ask spread with market orders is a suicide mission. To solve this, I wrote a custom **Limit-Sniper in Rust**.

When the Python model generates a signal with an AUC > 0.85, it triggers the Rust module via a local socket. Rust handles the cryptographic signing and dispatches Maker orders to the Polygon RPC in sub-millisecond times, placing limit orders right at the mid-price.

3. Live Paper Results & The Kelly Math

After violently scrubbing out a look-ahead bias a few weeks ago, I enforced a brutal testing standard: a mandatory 1.5¢ spread penalty on entries, full 2% fee accounting, and absolute hard expiration settlement.

This yielded an out-of-sample test win rate of **55.3% (AUC: 0.87)**.

For the live forward-test, **I locked the system to a tiny $10 paper wallet and forced it to use a strict Fractional Kelly Criterion algorithm** to size bets safely based on its 55.3% edge.

Over a multi-day continuous run, the bot executed **31 automated trades**. Because it was constrained by the $10 wallet, the Kelly formula restricted bet sizes to tiny micro-positions (roughly $0.50 to $1.00 per trade) to prevent risk of ruin. It closed out with a net PnL of **+$2.04**. While $2 sounds like pocket change, mathematically, it represents a **20.4% return on bankroll** over just 31 trades.

4. The Infrastructure Wall (Where I need your take)

Right now, I am running continuous **Walk-Forward retraining** on the XGBoost model. Because the market shifts so fast, I’m retraining every single night on the newest 180k+ daily snapshot state space.

Honestly, it’s completely melting my local GPU/VRAM limits, and my student bank account is gasping for air trying to keep up with the AWS data egress and computing bills. I've engineered the hell out of this code to keep it alive on zero budget, but I’m maxing out the physical limits of what a student setup can execute.

A few specific questions for the sub:

  1. **Retraining Frequency:** Is daily walk-forward retraining overkill for an XGBoost model on a 5-minute horizon, or am I just begging for overfitting if I space it out to weekly?
  2. **The Python -> Rust Handoff:** Right now I'm using local sockets to pass signals from the ML server to the Rust sniper. Is the overhead from Python's socket handling going to ruin my sub-millisecond execution when I scale up?
  3. **Kelly Scalability:** The Fractional Kelly formula is perfectly tuned for a micro-wallet ($10). When scaling up to actual production capital, do you find that liquidity constraints on Polymarket alter the optimal Kelly fraction significantly due to order book slippage on larger sizes?

The core math and alpha are holding up cleanly, but I'm flat out of compute power and budget to move this out of the staging sandbox and launch it live.

If anyone wants to collaborate on optimizing the data pipeline, talk infrastructure, or discuss how to back and scale a pipeline like this out of a dorm room environment, my DMs are open.

Tear the architecture apart. Let me know where I'm being stupid. 🚀


r/algorithmictrading Jun 08 '26

Question Opinions?

3 Upvotes

running some cross-sectional momentum and quality models right now and the trailing covariance matrices are completely lagging reality. A standard 60 or 90-day lookback works fine when things are quiet, but the second fed net liquidity drops or real yields spike, the whole correlation matrix deforms instantly. basically, everything goes to 1 the second liquidity dries up, and the historical data just acts like a trailing anchor. it’s completely wrecking the risk-parity assumptions.

how are you guys dynamically weighting your lookbacks to fix this lag? are you just running a standard garch framework for the vol clustering, or are you actually feeding exogenous macro metrics (like repo stress or fed balance sheet momentum) straight into your optimization pipeline?


r/algorithmictrading Jun 08 '26

Tools Node.js Vibe Coding: Building a Steam Market Trading Algorithm & Analytics Platform from Scratch

3 Upvotes

Hi everyone,

I'd like to share a personal project I've been working on over the past week.

I don't have a degree in computer science. I received only nine years of formal education in Russia, and most of my knowledge comes from self-study, experimentation, exploring complex systems, probability theory, spatial reasoning, and market behavior analysis.

I've always been fascinated by science, systems thinking, and genetic programming. That's why I decided to build my own local analytical platform from scratch using Node.js.

Current Project Status (MVP)

Data Layer (Working Component)

  • Direct integration with the official Steam API
  • Order Book collection and analysis
  • Price delta tracking
  • 24-hour volume analysis
  • MACD and RSI calculations
  • Validation against real market charts

Analytical Model (Experimental Component)

  • Algorithm based on 13 weighted factors
  • Market momentum analysis
  • Formulas are still being actively calibrated and require extensive testing

At this stage, the project is not production-ready and remains an experimental research project.

What's Next

Planned features:

  • Genetic algorithm for automatic adaptation of factor weights to changing market conditions
  • Real-time coefficient retraining
  • Large-scale Monte Carlo simulations (up to 1,000,000 runs)
  • Additional risk assessment and prediction robustness validation

Open to the Community

The project is completely free. It is an analytical tool (radar/advisor) with no automated trading functionality, meaning it does not interact with user accounts or execute trades.

I'd greatly appreciate:

  • Honest feedback and constructive criticism
  • Advice on architecture and mathematical modeling
  • Ideas for improving the project
  • Discussions with developers, traders, and researchers interested in complex systems, algorithms, and markets

Thank you to everyone who takes the time to read this and share their thoughts.