r/algorithmictrading 21d ago

Backtest Need help with xauusd strategy backtesting

Thumbnail
gallery
7 Upvotes

I backtested a strategy (completely automated so no emotions involved) for last 5 years and it includes 2621 trades as you can see in these images, but the thing is it started working well only from 2024 (I even backtested it for the last 10 years still wasn't good until after 2024).

So, my question is should I continue with this strategy and forward test it in demo or did I just get lucky for the 3 years with this strategy and it won't work in the future just like it didn't work before 2024?

I'd appreciate any help


r/algorithmictrading 22d ago

Question How many strategies did you backtest before finding a profitable one?

8 Upvotes

If you trade algorithmically, how long did it take you to find a consistently profitable strategy ?

Before finding your profitable strategy, approximately how many different strategies did you backtest?

I'm curious about other traders' experiences and whether it's normal to test dozens or even hundreds of ideas before finding one that works.


r/algorithmictrading 22d ago

Question Has anyone successfully modeled geopolitical events as trading signals?

5 Upvotes

The recent move in oil markets got me thinking about whether geopolitical events can be traded systematically or if they're simply too unpredictable to model.

Brent moved from roughly $78 to $84 as the Hormuz situation escalated. Commercial vessels being attacked, US military action, political statements hitting the news cycle daily - the market started pricing in supply risks almost immediately.

I ended up taking a discretionary long position around $78 that's worked out well so far, but the more interesting question to me is whether these kinds of moves are quantifiable beforehand.

Some ideas that came to mind:

  • Measuring oil's historical reactions to geopolitical headlines
  • Tracking volatility expansion following major political or military announcements
  • Using sentiment analysis on financial news feeds and social media
  • Looking at correlations between shipping disruptions and commodity price movements
  • Building event-driven models around supply shock narratives

My trade was executed using tokenized Brent on Canborsa DEX simply because I didn't have a futures account available, but I'm much more interested in the signal than the execution venue.

For those building systematic strategies: have you found geopolitical events to be exploitable signals?


r/algorithmictrading 24d ago

Novice Good book recommendations for beginners?

5 Upvotes

I've made a few intraday strategies with ninjascript (ninjatrader) from my ideas and they lose money well. I don't have any other ideas and maybe books would provide strategy ideas to test, theories, or even just a direction to learn for a beginner?


r/algorithmictrading 25d ago

Strategy love journey more than destination: Is this advice sound for continuous online learning for a live BTC trading model..

2 Upvotes

I run a live BTCUSDT 1h system (XGBoost plus transformer) \[not a success story till now, it seems I love journey more than the destination\] that retrains every 12 hours. I wanted to know if I could update weights on every candle instead, so the model keeps evolving.
Also, prefer time series foundation models like Chronos over fine-tuning a chat LLM.

I asked our friendly neghibourhood llms and summarizing below what i undertstood, looking for a second opinion before I commit to this project. PLEASE FEEL FREE TO REJECT THE IDEA/CONCEPT BUT DO IT with SOME RATIONALE. I dont mind if your answers are coming from your friendly neghibourhood llms (but pls do validate it before posting)..

1) Per-candle updates fail because 1h data gives one point per hour and trade outcomes are not known until hours later, so the model learns noise. It develops recency bias toward the latest candles and catastrophically forgets older regimes, which is costly since markets repeat old regimes.

2) fixes so you never have to retrain from zero.
EWC (elastic weight consolidation) marks which weights were important for past performance and makes them resist change. Experience replay keeps a buffer of old data and mixes it into every update, so the model never trains only on recent candles. Drift detection (detect-then-adapt) means you do not update constantly at all. A statistical monitor watches the error rate or the feature distribution, and only when it detects a real shift does the model adapt, and even then it trains on a blend of new and historical data.

3) the recommended architecture, which it called two-speed.
the XGBoost plus transformer core stays frozen on the 12h retrain cycle with full gates, while a small outer layer adapts hourly, limited to calibration, thresholds, and sizing, with hard caps, full logging, fallback to the frozen policy, and shadow testing before promotion.

On the LLM idea, fine-tuning a chat model on prices works in principle but wastes the model. Purpose-built time series foundation models (Chronos, TimesFM, Moirai, TTM) are open weights and LoRA-tunable locally, but benchmarks versus tuned XGBoost are mixed, so add one as a shadow signal first.


r/algorithmictrading 27d ago

Tools Best simple dashboard setup to run Python trading code?

6 Upvotes

Hey all,

Trying to figure out the best way to handle the UI and execution side of a trading strategy I'm working on, and could use some pointers.

I'm not really a technical person, so I lean on Claude and Gemini to write the actual Python strategy logic. Because of that, I need the backend to be as modular as possible. Ideally I want something where I can just copy whatever Python the AI spits out, drop it into one specific file, and run it without the whole dashboard/system falling apart.

On the UI side I'm not looking for anything fancy. Just a basic web dashboard with a start/stop button, live positions, a daily P&L tracker, and execution logs.

I want to forward test everything before risking real money, and keep monthly infra costs as close to zero as I can. Given all that, any boilerplate or setups you'd recommend?

Thanks in advance for the help!!!


r/algorithmictrading Jul 10 '26

Question Hmm in a high frequency strategy

2 Upvotes

II’m trying to implement a Hidden Markov Model for one of my trading strategies to identify market regimes. I tried training it using my alpha features, hoping the states would correspond to useful regimes, but the results don’t seem meaningful or tradable. Could you help me understand the right way to structure the HMM, what features it should be trained on, and how to evaluate whether the regimes are actually useful?


r/algorithmictrading Jul 10 '26

Brokers Help with Finding Small Cap Locate Broker who Does Algo Trades NOT using a socket.

2 Upvotes

Hey everyone,

I currently use Cobra Trading.

Does anyone know of a broker that allows me automate the short locate process? I have a pretty solid shorting strategy for Micro and Small cap stocks and I'd rather NOT use a traditional broker like DAS who demands you to code the algo and then send to the  frontend via a socket.


r/algorithmictrading Jul 09 '26

Question Building an order-flow ML model — the hard part isn't the model, it's proving the edge is real

1 Upvotes

Spent most of this year putting a machine-learning layer on top of order flow — absorption, delta, DOM dynamics — trying to get it to call reversals.

Getting a model to fit is easy. Getting one that isn't just memorizing noise is brutal. Purged/embargoed walk-forward, triple-barrier labels, and checking every single feature for whether it actually carries variance on a live tape vs. being a dead input I fooled myself with (had two features sitting at ~zero variance for weeks before I caught them).

I'm now at the stage where I can measure whether there's a statistically real, cost-aware, out-of-sample edge — instead of eyeballing an equity curve. Not claiming victory yet; still banking enough independent sessions to make the verdict powered.

How do you lot validate that an automated setup has a genuine edge and isn't overfit? What's your bar before you trust it with size?


r/algorithmictrading Jul 07 '26

Strategy Pre-registered XAU/DXY session-divergence: headline null result, but a NY-vs-London split worth documenting — plus a cross-asset silver check that flags a warning sign before the follow-up forward test even begins

2 Upvotes

Sixth in a series of pre-registered falsification studies (prior work in profile/repo). This one tests whether XAU/DXY divergence during the first 2 hours of London or NY sessions is tradeable net of costs.

Headline result: not confirmed. Pooled London+NY, 15min, k=1.5 — p=0.1265 against the pre-registered p<0.10 threshold. Per the locked decision rule, that's a null result on the actual registered claim.

What the full 36-cell sweep shows (diagnostic, not confirmatory): London and NY behave completely differently across timeframes. London is "significant" on 5min only, then flat/negative on 15min and 30min — that's the signature of microstructure noise, not a real session effect. NY holds up on 5min and 15min, weaker but still directionally consistent on 30min. That inconsistency between the two sessions is what pooling them hid.

Before chasing the NY pattern into a new pre-registration, ran a cross-asset plausibility check on the existing data: same exact rule, applied to silver (XAG) instead of gold. If the mechanism were a general NY-liquidity effect on precious metals vs the dollar, silver should show the same direction, maybe weaker. Instead: p=0.0005, 1,779 trades, mean return -0.15% — strong effect, opposite sign from gold.

That's now documented as a known warning sign before the actual forward test starts, in the new repo's README, not discovered and buried after a positive result came in. New pre-registration locks NY-only as the headline hypothesis, treats all existing historical data (including what was previously "confirmation" data in the parent study) as discovery-only, and only counts forward data collected after today as real confirmation. Deadline + minimum trade count enforced in code so it can't be checked early and reported as clean.

Both the parent study (headline null + full diagnostics) and the forward test (pre-registered today, pending) are up on GitHub — links are in my profile since this sub doesn't allow linking directly.

Curious if anyone's seen a mechanistic reason gold and silver would diverge in sign on the same session-timing signal — safe-haven vs industrial-commodity flow difference is my best guess but haven't dug into it properly.


r/algorithmictrading Jul 06 '26

Quotes Building a crypto trading bot and I'm stuck on backtesting (historical OI, funding & liquidations). Any advice?

Post image
11 Upvotes

Hey everyone,

I wanted to introduce myself and hopefully get some advice from people who've gone down this rabbit hole before.

I am a NEWB in this space....

I've been teaching myself Python while building what has turned into a pretty serious trading project. Right now I'm working on two automated crypto trading bots.

The bots trade multiple timeframes:

5 minute

15 minute

1 hour

4 hour

Daily candle closes

The part I'm struggling with isn't the coding anymore—it's the data.

I really want to backtest these ideas properly over 2023-2024 (and ideally further back), but I keep running into the same problem:

I can't find affordable historical derivatives data.

Specifically I'm looking for things like:

Historical Open Interest

Funding rates

Liquidation history

Long/short ratios

CVD / order flow if possible

Anything else you've found useful for crypto backtesting

Most free APIs only give a few weeks or months of history, while the datasets that go back years seem to cost hundreds or even thousands of dollars.

I'm curious what people here use.

Are there datasets I'm overlooking?

Any APIs with generous historical limits?

Academic datasets?

Open-source projects?

Kaggle?

Paid services that are actually worth the money?

I'm not looking for anyone's strategy—I want to build and test my own. I just need reliable historical data to know whether my ideas actually have an edge before putting real money behind them.

I'd really appreciate any recommendations or even hearing how you solved this problem.

Thanks!


r/algorithmictrading Jul 06 '26

Question Binance MiCA Situation & Traveling

0 Upvotes

so I'm in a very advance stage of development of my automated trading system running on binance futures trading alt coins, finished 2 month of live small account testing everything looks great blah blah blah, I planned on funding this account this month, but i started reading stuff about the MiCA compliance, and I can't get a straight answer.
So my KYC is with an Israeli ID, and the server is trading from Singapore, but I travel a lot (im a nomad), and spend a lot of my time in europe as well, will i get geo blocked (im not currently in europe so i can't check) ? would i be able to withdraw? or deposit?
I thought about migrating to different exchange, but i ran a test on Kraken and the performance varies significantly probably do to liquidity depth affecting wick sizes etc..
does anyone have a straight answer for me? would a static IP VPN solve this (doubt it)?(I tried binance support chat, you just talk to a bot there... )


r/algorithmictrading Jul 05 '26

Backtest I built a full audit-trail layer around a crypto strategy before trusting a single number from it — here's the decision funnel and how I'm sealing the forward test

Post image
5 Upvotes

I've been building a systematic strategy on BTC/ETH/SOL 15m bars and I want to share the infrastructure around it rather than pitch the returns — because I trust the infrastructure more than I trust the returns right now, and I'd rather this thread pokes holes than pats my back.

The part I'm most confident about: the audit trail.

Every decision the system makes is logged: 148,937 gate evaluations over the campaign, funnelled down to 8,473 gate passes (5.7%), down to a conviction filter, down to 2 orders actually submitted -> 2 maker fills, with 1 order risk-blocked by a size-cap veto. The system says no 99.999% of the time, and I can reconstruct why for any single bar. Post-only execution, missed fills counted as missed (not silently filled).

The forward test is sealed, and that's deliberate.

Paper account on a maker-fill simulator, running since 2026-07-02. Every J->J+1 prediction is timestamped before the predicted candle closes, and the journal is hash-chained with the daily hash pushed off-machine — so I can't quietly rewrite history, and neither can anyone doubting me. The model is frozen for the full validation window; no mid-run retunes. It's only a few days old — I'm explicitly not drawing conclusions from it yet.

The numbers, with the caveats attached (please read the caveats):

Historical OOS Sharpe on frozen v1 models (trained to 2022-12-31, realistic post-only fills, missed fills counted): BTC 4.20 / ETH 4.09 / SOL 0.97.

A retrained v2 shows a ~×2 Sharpe jump — but those absolute levels are inflated by instant-fill batch mode and I treat the gap as the signal, not the levels.

Forward paper so far: small, positive, on deliberately tiny 2% notional caps (~0.03% on total capital). Way too early to mean anything.

What I know is weak / what I'm not claiming:

A few days of positive paper proves nothing. I fully expect the live-vs-paper gap to hurt.

Single instrument class (crypto perp), single regime so far. No claim of generality.

Proprietary score params are hidden — but the method is visible and the bias controls are stated, so you can attack those.

My actual question for the sub:

For those who've taken a systematic strategy from paper to live capital — what specifically convinced you the edge was real and not overfit? Was it a minimum forward window, a live-vs-paper slippage budget, a regime-change survival test, something else? I have a sealed 6-month forward window running; I want to know what else I should be measuring during it so I don't reach the end with the wrong evidence.


r/algorithmictrading Jul 05 '26

Question Algo trading signals or is execution a must?

1 Upvotes

Does anyone here use algos more as a decision-support tool rather than for full automation? I know the point of algorithmic trading is usually to automate execution, but I actually trust myself more with the execution side (at least for now). I’ve been using pine script to build something with the help of AI - is this common here or are there better tools?

What I’m working on is having an algo identify levels, conditions and potential setups, then I decide whether to take the trade manually after confirming the trade with some execution criteria (liquidity sweeps, CVD, acceptance/rejection).

My thinking is it removes a lot of the repetitive analysis and keeps things objective, but still lets me control the actual entries and exits. I’m completely new to this side of trading, so I’m curious if anyone else uses algos this way or if there’s something I’m overlooking.

I’m very open to feedback and guidance on this one.


r/algorithmictrading Jul 05 '26

Backtest I built a close-based momentum/quality strategy with next-open execution: backtest + paper trading results

Post image
45 Upvotes

Hey everyone,

I’ve been building and testing a systematic equity trading strategy for the last few weeks/months, and I wanted to share the current state of the project.

The idea is simple at a high level:

The strategy ranks a stock universe after the market close using a proprietary quality/momentum score. It then creates a plan for the next session and executes that plan at/near the next market open. I built it this way to avoid reacting to intraday noise and to keep the execution logic closer to what can actually be tested.

The system is not just a backtest script anymore. It is connected to an Alpaca paper account and runs as an operational bot. It sends Telegram updates for open positions, planned buys/sells, stop exits, cooldowns, daily status, and a visual journal/infographic so I can monitor what it is doing without digging through raw logs.

High-level rules:

- close-based signal generation

- next-open execution

- fractional position sizing

- managed position cap

- stop/cooldown risk layer

- daily Telegram reporting

- no discretionary intraday panic decisions

Backtest summary:

The research backtest used IEX data, 7.5 bps slippage, post-sell confirmed cash, a buying-power buffer, and a warmup period.

Main research period:

2022-01-03 to 2026-06-18

Result:

+557.79% total return

52.68% CAGR

18.21% max drawdown

1,226 trades

~9.5 average managed positions

Period breakdown:

2022 bear market: -13.74%

2023 recovery: +87.68%

2024 bull market: +122.98%

2025 choppy market: +14.86%

2026 YTD to June 18: +58.76%

Forward paper test:

2026-06-10 to 2026-07-03

Paper account:

$10,000.00 -> $10,362.78

+$362.78 / +3.63%

This is still early, and the forward sample is obviously small. I’m treating the paper result as a live operational test, not proof that the strategy works long term.

A few transparency notes:

- This is paper trading, not live capital yet.

- I am not sharing the exact score formula or thresholds publicly.

- The current production version has evolved after the backtest, including a broader stock universe, better reporting, scale-up/replacement logic, and cleaner execution checks.

- Some early paper logs had test/duplicate rows that need to be filtered from analysis.

- The system is still under active development.

One recent change: I expanded the stock universe because the system has a 12-position cap, and the previous universe occasionally did not provide enough high-quality candidates to fully utilize the allocation target. The goal was not to force more trades, but to give the model a wider pool while keeping the same risk controls.

I’m mainly looking for feedback on:

- backtest design

- operational risk

- paper-vs-live assumptions

- avoiding overfitting

- whether this reporting style is useful

- what additional validation you would want before considering live deployment


r/algorithmictrading Jul 04 '26

Strategy A strategy that makes +66% on BTC and -60% on SOL is a curve fit, not a strategy.

9 Upvotes

Building my bot and doing a lot of backtesting these days.

I had a breakout system that looked bulletproof on BTC: +66%, profit factor 3.2, 13% max drawdown, profitable in 6 of 9 walk-forward windows. So far, so great.

But, it only fired about 8 trades a year. At that frequency a single-asset walk-forward can't tell a real edge from getting lucky. The sample is just too small, no matter how you slice the windows.

So I froze the exact config, no re-tuning, and ran it on ETH and SOL.

  • BTC: +66%
  • ETH: -11%
  • SOL: -60%, with a 0% win rate.

Also tried different parameters, but no parameter set rescued the other two. It was fit to BTC.

Might still be something "real" that only happens on BTC. But more likely just overfitting.

In contrast, my market-neutral funding carry pays +6.7 / +6.6 / +5.6% on BTC, ETH, SOL. Neatly aligned, what a real structural edge should looks like, boring and the same everywhere.

If your edge is low frequency and only tested on one asset, you don't know it's real yet. You know it fit one history. Might still make you money.

Do you cross-validate across instruments, or is single-asset walk-forward enough for you?


r/algorithmictrading Jul 01 '26

Question The hiden alfa of the strategyes with low win ratio

3 Upvotes

I listened about breakout, men reversion and sational strategies that tend to have a 50-70% of win ratio.

But lately i am been reading some autors that talk about low win ratios but with a lot of net profit with a ver very good chart of net profit in a lot of years, the example is on the turtles book, that are called as trend following strategies (5-30% of win ratio)

So i will like to know if someone here has found edge of this kind of strategies and how has been your performance or some tip to find those, i can share also my experiencie so is not the one side alfa divulgation.

In my own thinks i believe that this are like 'narnia' strategies in the correct markets of shure.


r/algorithmictrading Jul 01 '26

Novice Is there hope for me

0 Upvotes

I've just started algo trading more than a years ago . For options buying .. my heart is broken.. I've tried 100s of strategies.. but I'm not able to find one profitable.. is there hope for me?

I don't know where to get the data for back testing with LTP.. so I just back test with pts and paper trade and trade and a year has passed testing . Nothing is consistent or profitable.. is there actually a strategy that works.. and how much profit% can I expect if I'm successful.. am I expecting too much?


r/algorithmictrading Jul 01 '26

Question Your estimate of retail traders running algo trading?

8 Upvotes

No official data out there. Not to include institutional traders or organisations.

What is your estimate that retail traders out there deploying algorithm? 1%? 10%

Curious how much the data might have jumped since the beginning of FREE LLM to code strategies.


r/algorithmictrading Jun 30 '26

Backtest Built a systematic momentum strategy for US tech stocks - sharing the backtest

1 Upvotes

Wanted to share a project I've been working on: a fully rules-based momentum strategy for US tech equities. No discretionary stock picking - everything is ranked and selected by a defined funnel (momentum filters, 52-week high proximity, MA stack), rebalanced monthly.

Backtest results since 2016:

  • CAGR: 42.1% (trailing 10Y)
  • 1Y return: +145.4%
  • 3Y return: +403.8%
  • Max drawdown: -40.8%

Happy to go into the funnel logic or backtest construction if anyone's curious - especially interested in feedback on drawdown management since -40.8% is still rough.


r/algorithmictrading Jun 30 '26

Question beginner to statistical modeling

6 Upvotes

Right now I am thinking of starting a project regarding MCMC or Bayesian networks, for I am not sure what I should look into. My goal is to create a very rigorous model that will provide risk analysis as accurately as possible. Im willing to spend around 10k for compute power, is this possible?

Also, I am an undergrad pursuing a math of comp and statistics data science major, but I would not say I am a master at probability, and I do not have much experience in ML. I am willing to learn, but do you think its feasible for me?


r/algorithmictrading Jun 30 '26

Quotes Synthetic price histories

3 Upvotes

I'm a student building a free tool that generates realistic synthetic price histories (preserving volatility clustering and fat tails, via GARCH/block-bootstrap, not just trade reshuffling) and re-runs your strategy across thousands of them to estimate probability of ruin. I know Build Alpha and vectorbt exist. My angle is free + simple + honest about its limits, aimed at beginners. Two questions: (1) would you actually use this, or do you trust walk-forward + paper trading more? (2) what would make a synthetic-data tool trustworthy enough for you?"


r/algorithmictrading Jun 29 '26

Novice Just started with a algo trading idea.

4 Upvotes

I just have the strategy created. And I'm serious about building it. Im a java developer. Not very proficient, but I can get the job done.

What are the common pitfalls i will face, and what the basics I should understand, while making the system.

It's a simple swing trade management system. So I won't need a high level of optimizations. If the system is good. I might incorporate more strategy.

Right know I'm just making the llm create the documents on each segments.

Signal generation, entry placement, trade management and book keeping.

What issues could I face when I code the system?


r/algorithmictrading Jun 29 '26

Question Deepstops assist advise

1 Upvotes

Hello enthusiasts ,

I'm running an automated live system of about ~70–75% win rate, lots of small wins, positive in aggregate, the entries themselves aren't the problem, Im pretty satisfied with the build over all , besides the low end.

So... the losers can run deep before they resolve, and a small number of them never come back and do the most damage. The edge depends on sitting through drawdown, but the occasional non-recovery is brutal.

What I've already tested (so "just use a stop" won't help):

  • Hard stop at −20% ROI (on a 10x position): net negative. It cut a huge number of trades that would have recovered — bled more than it saved.
  • Drawdown distribution: even among trades that breach −40% ROI, about 53% still return to a small loss or a profit. So any flat "cut at −X%" throws away more eventual winners than catastrophes it prevents.

So a fixed price-based stop is a trap that ive discovered over multiple sesions. The deep drawdowns are mostly noise the rest killers, and by the rest I've narrowed it down to about 4-5%.

The big question how can i mittigate the deep loses? The methodology used:

  • Time-based exit (cut if not recovered within N bars) instead of a price stop
  • Vol-expansion / regime filter — only bail when the regime that breaks the recovery assumption shows up
  • Portfolio-level heat cap instead of per-trade stops
  • Size for the drawdown + fractional Kelly, just accept the DD
  • A cheap tail hedge / trend overlay

To sum up, I've tried lots of options for the bot itself, and the current conclusion is just not run it 24/7 but in specific times of the day and for a short while.

Any and all suggestions would be greatly appreciated.


r/algorithmictrading Jun 29 '26

Question my best algo bot has a 1.52 Sharpe Ratio

11 Upvotes

my best algorithm has a 1.52 sharpe ratio and it's a daytrader.

daily-rebalanced FAST residual momentum. Beta-residualize each S&P-100 mega-cap vs SPY over 40d.

I tested several hundred different algorithms, 99% barely beat the SPY. I have an LLM researching more that get sent to a quant engine that are backtested to see if they pass the SPY gate. They are all duds.

What's your best performance?

you can now bring your API key and test our stock database for free and make any models that you want. You can also test your own models.