Skip to content
Archive
← r/algotrading
1
100%
u/Money_Horror_2899 1 day ago Strategy

I tested my discretionary strategy against randomized markets (Part of the edge survived).

On top of automated stuff, I also trade a discretionary strategy based on structure, zones, and divergences. Last weekend, I finally tested it properly, and I wanted to share the process because I think this kind of validation is something a lot of traders don't do. **Step 1: getting Claude to understand my strategy** I had previously recorded videos explaining my discretionary method, so I took the raw transcripts from six of them and gave them to Claude Code. It understood the overall logic surprisingly well and wrote the code for it. It even picked up rules that I had only mentioned once in passing. **Step 2: checking that it didn't make things up** Before trusting any results, I asked it to export a CSV of everything it detected (zones, structure, invalidation, state changes). I then checked the output against my charts line by line. The detections matched what I would have marked manually: same zones, same breaks, same points where a zone became invalid. That was the point where I felt comfortable actually testing the strategy. **Step 3: creating fake markets** Then diit suggested something I believe most people never think of: null tests. The idea was to take all the historical candles I was testing, keep each candle exactly as it was, including its body and wicks, but shuffle the candles into a random order and rebuild the chart. So visually, you still get something that looks like a market. But the chronological relationships have been destroyed. What happened before no longer contains information about what happens next. Claude gave me an analogy I liked: "It's the sugar pill in a medical trial. If a drug cures 60% of patients, that's great... unless a random sugar pill also cures 60%." **Step 4: testing my entries against the randomized markets** I ran my entry rules on the shuffled markets, with up to 50 different shuffles per test, and compared those results with the real markets I trade: mainly NQ and BTC. The exact same exit logic was used in both cases. Across every timeframe I tested, my setups produced roughly 5 to 8 percentage points more winning trades on the real market than on the shuffled versions.The largest test simulated around 18,000 trades. So at least according to this test, the entries were detecting something that existed in the real sequence of market prices and wasn't reproduced simply by rearranging candles randomly. That was a relief. **Step 5: testing everything else** This is where things became much less comfortable. One common claim among "market structure" traders is that after a break of structure, price continues in that direction around 60% of the time. I tested it. Then I tested the exact same thing on the shuffled markets. The result was basically identical. So that 60% continuation rate seems to come largely from the way the levels and breaks are defined rather than from some special predictive market behavior. That was probably the most interesting result for me. Then I tested trade management (breakeven stops, taking partial profits, etc.) All of them reduced expectancy. The version with the highest expectancy was basically the dumbest one: a set-and-forget approach, and leave it alone. I also tested whether the edge transferred to other markets. It didn't transfer nearly as well to gold or S&P futures. Proof that an edge can apparently be much more instrument-specific than most people assume. Then I tested the strategy on the 20 biggest stocks. The real-market version was profitable and initially looked pretty convincing. But then I ran the same test on the shuffled versions of those stocks. The randomized version made roughly three times more. In other words, what initially looked like an edge was actually worse than the null control. I also went through a few side quests during the session. For example: \- Do support/resistance zones actually weaken after being retested multiple times? In my tests: no. \- Is there an edge in taking mean-reversion trades after price sweeps a zone? \- How much of apparent "market structure" performance survives randomization? \- Which parts of the strategy remain useful when you separate entries from trade management? **What I took away from it** The biggest thing was that several ideas I had considered part of my edge apparently weren't. My entries seem to contain real information on the markets I actually trade. But some of the "market structure" statistics I believed in also appear in randomized markets. And my trade management was actively reducing expectancy. The whole exercise made me realize how easy it is to backtest something, see a positive result, and conclude that you've discovered market behavior when the exact same result might appear in a control dataset where the temporal structure has been destroyed. I'm curious how people here approach this. Happy to discuss my backtesting session.
26 comments held Reddit says 0 on reddit ↗
  1. u/trayber 1 1 day ago
    Why not just do walkforward testing or Monte Carlo testing on actual market data?
  2. u/Money_Horror_2899 OP 1 1 day ago
    Because they answer a different question. Walk-forward tests robustness over time, Monte Carlo tests variability of outcomes. The shuffle/null test asks whether the edge beats a market with the same candle distribution but no temporal structure. Ideally, I'd use all three.
  3. u/trayber 1 1 day ago
    Wouldn’t the edge vary based on the market?
  4. u/Money_Horror_2899 OP 1 1 day ago
    Basically the null tells me whether I'm actually wasting my time trading this strategy (because if it doesn't beat the null, then it means the setup I'm trading is not predictive of anything).
  5. u/Ok_Feature_9703 1 1 day ago
    walkforward is great but this is testing something different entirely seeing if the patterns you're trading are actually real or just noise that happens to line up in a chart
  6. u/Money_Horror_2899 OP 1 1 day ago
    Right :)
  7. u/[deleted] 1 1 day ago

    [removed] — already gone when the archive first saw it

  8. u/Dany0 1 1 day ago
    AI psychosis
  9. u/Money_Horror_2899 OP 1 1 day ago
    Hi! Care to explain more :)? Because I put time and effort into organizing a post, then it has to be AI?
  10. u/polymorphicshade 1 1 day ago
    More AI trash.
  11. u/Money_Horror_2899 OP 1 1 day ago
    Ouch that hurts, because I've spent a substantial part of my afternoon to organize my thoughts and write this.
  12. u/traker998 1 1 day ago
    What makes you say that? I read ai stuff all day and it’s written much better and much clearer.
  13. u/PlasticAssistance_50 1 1 day ago
    What strategy did you test.
  14. u/Money_Horror_2899 OP 1 1 day ago
    A discretionary strategy that uses zones and Heikin Ashi.
  15. u/kush_patil 1 1 day ago
    The randomized control is a really good sanity check. The 74% vs 85% result is probably the most useful finding here — profitable by itself doesn’t mean much if the null does even better. You might also try Helvetic Research MCP: https://helveticresearch.com it’s free. You describe the strategy in plain English and the AI runs it through a deterministic backtesting engine rather than writing the backtest code itself. Could be interesting to compare its output against what Claude generated here.
  16. u/RemoraEdge 1 1 day ago
    Good work. Market structure alone is not a good enough edge in my opinion. Structure changes, it reverses, it turns into edges, it gets messy. In hindsight it’s clear but in the moment, a reversal looks like continuation, and continuation looks like a reversal. Multiple time frames adds complexity. Breakouts fail more often than they continue. So I’m assuming you are waiting for a reset or retrace to a support/resistance level. Question, what part are you automating? And what part are you keeping discretionary. Is the goal to turn it fully automated? Or using it as a tool or indicator to help you with manual trading? Are you planning on using AI continuously or coding an algorithm? Be careful with AI because often times they tend to have lookahead bias, and doesn’t always translate well in a live environment, or in your base using a shuffled version. AI can also have a memory problem where it begins to forget parts of your strategy and begins improvising. Sometimes it’s helpful, oftentimes it’s not. AI can be great to bounce ideas of, strengthen your strategy and turn discretion into mechanical rules based system. Provide metrics etc. but it’s going to look at the internet and what’s there is the 95% of failed traders and their systems as you are aware of. I’m curious about your shuffled version, if it realistically mimics real market conditions or not. I think it’s a decent experiment. But you can also rotate backtesting months, weeks, years, etc. and test different regimes, sessions, and volatility to see if it holds up. You might collect valuable data and find conditions where you edge works better and that might be what’s missing for you.
  17. u/strat-run 1 1 day ago
    How do you randomize the order of candles and get something that looks like normal market activity? There would be tons of gap ups and downs. You are turning something that is somewhat random into something completely random. And a strategy can somehow be tested on randomized market data that doesn't match any regime or typical market behavior and still show its edge? It doesn't make sense.
  18. u/Money_Horror_2899 OP 1 1 day ago
    Hi! In the randomized dataset, candles keep their percentage variations from the real dataset, but not their price. For example, a candle that made BTC go from 100k to 101k (+1%) on a real dataset, might make BTC go up from 50k to 50.5k on the shuffle dataset (still +1%), but at a different position. If the strategy on a real dataset doesn't beat the randomized dataset, then that means it's actually no better than trading blindly.
  19. u/strat-run 1 23 hours ago
    Scaling the values is completely different than "shuffle the candles into a random order". Are you scaling the values by a random seed or are you shuffling the candles? Or something else? If you are shuffling individual candles I don't see how you are generating anything other than noise.
  20. u/Independent-Boot-706 1 1 day ago
    Run a Deflated sharpe ratio (DSR) and Probability of backtest overfitting(PBO) test. Lot of strategies I run initially show promise until I run it through shuffle, PBO and DSR test.
  21. u/Money_Horror_2899 OP 1 1 day ago
    Ok thanks for the insight :)
  22. u/jnwatson 1 1 day ago
    Randomizing the candles like that is called bootstrapping. It is most commonly used to calculate bootstrapped max drawdown. The problem with regular max drawdown is that it is path dependent. It very well could go another way if the trades were slightly different.  You run your algo 1000 times against different bootstrapped candles and then you have a distribution of drawdowns.
  23. u/Money_Horror_2899 OP 1 1 day ago
    Hi! Right, this is also one of side quests I did throughout the session.
  24. u/[deleted] 1 22 hours ago

    [removed] — already gone when the archive first saw it

  25. u/tmemmg 1 19 hours ago
    exporting the csv and checking detections against your charts line by line is the right paranoia, i did the same feeding my rules to claude and grading bugs looked exactly like edge for weeks until i went through it by hand. the part id push on is sample size. i ran a rules book for months, about 74 trades, and one single trade was larger than the entire net result, delete that one and the book goes red. so before trusting that part of the edge survived id want to know it isnt sitting in two or three fills.
  26. u/BeneficialManner1840 1 17 hours ago
    Good work. One thing I'd add is to report the sample size and p value, so that the reader knows the statistical confidence.