<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: maduka Jayawardana</title>
    <description>The latest articles on DEV Community by maduka Jayawardana (@madukaj).</description>
    <link>https://dev.to/madukaj</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4219464%2F5eec8646-e18b-492e-8a27-9ce63d4533df.jpg</url>
      <title>DEV Community: maduka Jayawardana</title>
      <link>https://dev.to/madukaj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/madukaj"/>
    <language>en</language>
    <item>
      <title>I Slowed My Trading Bot Down to Four Trades a Year. It Tripled a Backtest, and It Still Failed.</title>
      <dc:creator>maduka Jayawardana</dc:creator>
      <pubDate>Sun, 01 Nov 2026 14:27:01 +0000</pubDate>
      <link>https://dev.to/madukaj/i-slowed-my-trading-bot-down-to-four-trades-a-year-it-tripled-a-backtest-and-it-still-failed-4ml7</link>
      <guid>https://dev.to/madukaj/i-slowed-my-trading-bot-down-to-four-trades-a-year-it-tripled-a-backtest-and-it-still-failed-4ml7</guid>
      <description>&lt;p&gt;&lt;em&gt;Guarded Trader, Part 2: fees stopped mattering. The other problems didn't go away.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://dev.to/madukaj/i-built-an-ai-trading-bot-the-best-thing-it-did-was-refuse-to-trade-28ap"&gt;Part 1&lt;/a&gt; the problem was fees. A $100 Kraken account is stuck on the lowest fee tier: 0.80 % per taker fill. Add 0.10 % slippage and every round trip costs about 1.8 %. Every strategy I tested traded often enough that fees ate everything.&lt;/p&gt;

&lt;p&gt;So round 2 asked the obvious next question. &lt;strong&gt;What if it barely trades at all?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The rule for this round: more than &lt;strong&gt;4 round trips in any calendar year is an automatic fail&lt;/strong&gt;. At that pace, even 1.8 % a round trip is a rounding error.&lt;/p&gt;

&lt;p&gt;The short version: the economics worked, and the test still said no. I think the test was right.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four candidates
&lt;/h2&gt;

&lt;p&gt;Everything was written down and frozen before a line of strategy code existed. That means the parameters, the costs, the pass/fail rules and my predictions. It was hashed into an append-only trial registry. Nothing could be tuned after I saw a result.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Rule&lt;/th&gt;
&lt;th&gt;Checked&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Trend filter&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Hold BTC while it's 5 % above its 200-day average; sell when it's 5 % below&lt;/td&gt;
&lt;td&gt;weekly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Dual momentum&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Hold BTC or ETH, whichever went up more over 12 months, if it went up at all&lt;/td&gt;
&lt;td&gt;monthly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Vol target&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Hold BTC at a size that targets 50 % annual volatility; rebalance only on a 20 % drift&lt;/td&gt;
&lt;td&gt;monthly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Trend × vol&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The trend filter's on/off, the vol target's sizing&lt;/td&gt;
&lt;td&gt;weekly&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;None of these is new. That was the point. If the textbook slow strategies can't clear the bar, nothing clever I invent is likely to.&lt;/p&gt;

&lt;p&gt;Costs were the real Kraken Tier-1 numbers: 0.80 % taker + 0.10 % slippage per fill. I also ran 0.40 % maker, 0.30 % slippage and double fees. The data was Kraken's own candle archive. The start balance was the CA$35 that is actually sitting in the account.&lt;/p&gt;

&lt;h2&gt;
  
  
  The money looked good
&lt;/h2&gt;

&lt;p&gt;On the scored range, January 2022 to September 2026, which includes the 2022 crash and the 2025–26 slide:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Net return&lt;/th&gt;
&lt;th&gt;Max drawdown&lt;/th&gt;
&lt;th&gt;Sharpe&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Trend filter&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+200 %&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;27 %&lt;/td&gt;
&lt;td&gt;0.85&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trend × vol&lt;/td&gt;
&lt;td&gt;+199 %&lt;/td&gt;
&lt;td&gt;27 %&lt;/td&gt;
&lt;td&gt;0.88&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dual momentum&lt;/td&gt;
&lt;td&gt;+167 %&lt;/td&gt;
&lt;td&gt;38 %&lt;/td&gt;
&lt;td&gt;0.73&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vol target&lt;/td&gt;
&lt;td&gt;+124 %&lt;/td&gt;
&lt;td&gt;60 %&lt;/td&gt;
&lt;td&gt;0.60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;em&gt;Just holding BTC&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;+78 %&lt;/td&gt;
&lt;td&gt;67 %&lt;/td&gt;
&lt;td&gt;0.48&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The trend filter sat out most of 2022, got back in early 2023, and stepped aside in November 2025. It closed &lt;strong&gt;four trades in nearly five years&lt;/strong&gt;. Fees were about 7 % of its gross winnings. Doubling the fees to 1.80 % a fill still left it at +174 %.&lt;/p&gt;

&lt;p&gt;So the thing that killed round 1 is gone. At four trades a year, a $35 account on the worst fee tier is not the problem.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ "+200 %" is on about US$25 (the CA$35). That's about $50 of profit, on a backtest, over almost five years.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  And then the gate said no
&lt;/h2&gt;

&lt;p&gt;The project's first gate (Gate 1) is deliberately unfriendly. &lt;strong&gt;All four failed it&lt;/strong&gt;, and not narrowly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. It needs at least 100 closed trades.&lt;/strong&gt; I knew before running anything that this was impossible. Four trades a year over 4.75 years is 19 at most. The conflict came up before anything ran. I chose not to change the gate, and ran it anyway. A gate you rewrite for the candidate in front of you isn't a gate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. It needs an in-sample Sharpe of at least 1.0.&lt;/strong&gt; The best was 0.85.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Walk-forward testing saw something different.&lt;/strong&gt; The test chops history into 3-month windows, each starting flat, and ignores any position still open when a window ends. A strategy whose trades last 7 months almost never closes a trade inside one window. What's left are the few quick losers. Pooled out-of-sample Sharpe was &lt;strong&gt;−1.25&lt;/strong&gt;. That's a blind spot of the test for this kind of strategy, not a verdict on it, and I wrote it down as one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. No single trade may be more than 30 % of the profit.&lt;/strong&gt; With four trades, one of them always is. Dual momentum's single best trade was 115 % of its net profit. The other three lost money.&lt;/p&gt;

&lt;p&gt;Points 1, 3 and 4 are really one finding: &lt;strong&gt;Gate 1 can't certify a strategy this slow.&lt;/strong&gt; That's a real limitation and a fair thing to revisit, in writing, in a separate decision. It is not a reason to quietly lower the bar this round.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test that actually matters: was it luck?
&lt;/h2&gt;

&lt;p&gt;This is the part I'd keep if I could keep only one.&lt;/p&gt;

&lt;p&gt;I built a second control I called the &lt;strong&gt;matched null&lt;/strong&gt;. For each strategy, it keeps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the same number of times in and out of the market,&lt;/li&gt;
&lt;li&gt;the same total time in the market,&lt;/li&gt;
&lt;li&gt;the same position sizing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It just puts the switches at &lt;strong&gt;random dates&lt;/strong&gt;. Then it does that 200 times. If the trend filter's timing is skill, it should beat almost all of those random versions.&lt;/p&gt;

&lt;p&gt;It beat &lt;strong&gt;84 %&lt;/strong&gt; of them. The rule was 95 %.&lt;/p&gt;

&lt;p&gt;Random timing with the same exposure did as well as my "skill" about one time in six. The other three were at the 72nd–94th percentile. Nothing cleared 95 %.&lt;/p&gt;

&lt;p&gt;That's the honest summary of a 200-day trend filter on one asset, over one five-year stretch: it looks great, and &lt;strong&gt;nine in-out decisions are not enough evidence to tell a rule from a lucky calendar&lt;/strong&gt;. The Deflated Sharpe Ratio says the same thing. It corrects for the 26 strategies this project has now tried, and it comes out at 0.26–0.35.&lt;/p&gt;

&lt;h2&gt;
  
  
  Over the longer run, holding BTC won on return
&lt;/h2&gt;

&lt;p&gt;Going back to 2015 (supplementary, not the gate), every candidate made &lt;strong&gt;less&lt;/strong&gt; money than simply holding BTC. The exception was dual momentum, on its shorter 2016 start. Holding BTC turned $25 into about $6,500 in the backtest. The trend filter turned it into about $4,900.&lt;/p&gt;

&lt;p&gt;What every candidate did do was cut the worst drawdown: buy-and-hold fell 84 % at its worst, the trend × vol strategy 53 %.&lt;/p&gt;

&lt;p&gt;That matches what I predicted before running anything: &lt;em&gt;"its edge over buy-and-hold, if any, is drawdown, not return."&lt;/em&gt; Lower drawdown is worth something. It isn't the same as an edge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two small things that would have bitten in real life
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;$35 is too small for the strategies that rebalance.&lt;/strong&gt; Kraken's minimum BTC order is about $4.66. The vol-target strategies wanted to trade slices as small as $3.61. Only the two all-in or all-out strategies are even tradeable at this size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I found a bug in my own control.&lt;/strong&gt; The random-entry null draws a random number per candle, keyed by the candle's timestamp. The code divided timestamps by 10⁹, assuming nanoseconds. The pinned Docker image's pandas loads Kraken's candles at second resolution, so every candle got &lt;strong&gt;the same&lt;/strong&gt; random number. Round 1's Freqtrade data was in milliseconds, so it got one number per ~12 days.&lt;/p&gt;

&lt;p&gt;The fix is three lines and a regression test. I rebuilt the reports with a mode that refuses to write unless every recorded result is reproduced bit for bit, and they were. Only the null changed.&lt;/p&gt;

&lt;p&gt;The bug did not change any verdict, in either round. I re-scored round 1's null the same read-only way. Its percentiles moved (one EMA-cross candidate dropped from the 86th to the 70th), but every candidate also failed on other checks.&lt;/p&gt;

&lt;p&gt;Still, a control that silently doesn't randomise is exactly the kind of thing that makes a backtest lie. It's now in the results doc, in public, next to the numbers it affected.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what happens now
&lt;/h2&gt;

&lt;p&gt;Nothing, on purpose.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The project stays &lt;strong&gt;paused&lt;/strong&gt;. The rule for unpausing is "a strategy passes Gate 1 at real costs", and none did.&lt;/li&gt;
&lt;li&gt;No API key exists, no server is running, and the CA$35 stays parked.&lt;/li&gt;
&lt;li&gt;An LLM wrote and ran this round's backtests: in a sandbox with no network, no keys, and the results registry counting every attempt. It can't place an order, and it didn't get to pick the rules it was scored against. Those were frozen first.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What I'd do differently next, and will decide in writing before running anything:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A gate built for slow strategies.&lt;/strong&gt; Fewer trades, but more history, more assets, and the matched null as the main test instead of a trade count. That's a decision record, not a tweak.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More independent decisions.&lt;/strong&gt; The same rule across several assets gives the null more than nine switches to judge.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you take one thing from this round: &lt;strong&gt;slowing down fixes fees. It doesn't fix the question of whether the signal is real.&lt;/strong&gt; The tests that ask that question are the ones worth keeping, even when they cost you a nice-looking +200 %.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Everything here, including the frozen pre-registration, the results and the bug, is in the repo: &lt;a href="https://github.com/aplicy-com/guarded-trader" rel="noopener noreferrer"&gt;github.com/aplicy-com/guarded-trader&lt;/a&gt;, under &lt;code&gt;docs/research/07-round2-preregistration.md&lt;/code&gt; and &lt;code&gt;08-round2-results.md&lt;/code&gt;. This is a research project, not financial advice. It has no proven edge, and its own results say so.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
      <category>cryptocurrency</category>
    </item>
    <item>
      <title>I built an AI trading bot. The best thing it did was refuse to trade.</title>
      <dc:creator>maduka Jayawardana</dc:creator>
      <pubDate>Sat, 31 Oct 2026 17:49:00 +0000</pubDate>
      <link>https://dev.to/madukaj/i-built-an-ai-trading-bot-the-best-thing-it-did-was-refuse-to-trade-28ap</link>
      <guid>https://dev.to/madukaj/i-built-an-ai-trading-bot-the-best-thing-it-did-was-refuse-to-trade-28ap</guid>
      <description>&lt;p&gt;Over eight weeks I built a safety-first, AI-assisted crypto trading system, drilled it until it held, and tested every strategy honestly. None beat simply holding Bitcoin after real fees, so it never traded real money. That result is the point, and the whole thing is now open source as &lt;strong&gt;Guarded Trader&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I built it
&lt;/h2&gt;

&lt;p&gt;I wanted a self-improving AI trader, and I wanted it to be impossible for it to hurt me. So before writing any code, I wrote four rules and made the system enforce them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;One deposit of $100, never topped up.&lt;/strong&gt; The worst case is bounded from day one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It trades only that $100 plus its own profit.&lt;/strong&gt; No other money in the account counts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Profit above a daily cap is fenced off&lt;/strong&gt; for me to withdraw by hand. The system can never move money.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hard loss limits halt trading&lt;/strong&gt;, and only a human can resume it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One principle sat above all of them: the AI may &lt;em&gt;propose&lt;/em&gt; strategies, but it never places an order. Every idea from the language model is treated as an untrusted proposal until deterministic tests say otherwise.&lt;/p&gt;

&lt;p&gt;This came out of early research. Public experiments that let large language models trade real money directly mostly lost, largely to over-trading and fees. I did not want to repeat that.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;Guarded Trader splits the system into two trust domains: a boring, deterministic execution side, and a research side where AI ideas live until they earn their way across.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Why it matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Freqtrade&lt;/td&gt;
&lt;td&gt;Executes orders, runs built-in protections&lt;/td&gt;
&lt;td&gt;Mature, open-source execution; dry-run and live share one code path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Conductor (my service)&lt;/td&gt;
&lt;td&gt;Ledger, capital rules, risk checks, kill switch, Telegram control, dashboard&lt;/td&gt;
&lt;td&gt;A second, independent safety layer that derives risk from its own ledger&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Research harness&lt;/td&gt;
&lt;td&gt;Walk-forward backtests, trial registry, random-entry baseline&lt;/td&gt;
&lt;td&gt;Stops lucky backtests from looking like skill&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Code admission gate&lt;/td&gt;
&lt;td&gt;Static checks and a no-network sandbox for AI-written strategies&lt;/td&gt;
&lt;td&gt;AI output is untrusted code until proven otherwise&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hosting&lt;/td&gt;
&lt;td&gt;Hetzner VPS, zero public ports, Tailscale-only access&lt;/td&gt;
&lt;td&gt;Nothing to attack from the internet&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A few design choices did most of the work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fail closed.&lt;/strong&gt; Freqtrade boots paused. Conductor starts it only if no halt is active.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Halts survive everything.&lt;/strong&gt; They live in the ledger, so restarts, crashes and even a full server rebuild cannot clear them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every destructive command needs a code.&lt;/strong&gt; &lt;code&gt;/kill&lt;/code&gt;, &lt;code&gt;/flatten&lt;/code&gt; and &lt;code&gt;/resume&lt;/code&gt; in Telegram each ask for a one-time confirmation code within 60 seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keys can never withdraw.&lt;/strong&gt; The exchange key is created without withdrawal rights and checked by a script before every go-live.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How I tried to break it
&lt;/h2&gt;

&lt;p&gt;Safety features you never test are just hopes. Before any real money, I ran six drills against the live server, and all six passed.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Drill&lt;/th&gt;
&lt;th&gt;What I did&lt;/th&gt;
&lt;th&gt;What it proved&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Kill switch&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/kill&lt;/code&gt; from my phone&lt;/td&gt;
&lt;td&gt;New entries paused in about 10 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nuclear&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/flatten&lt;/code&gt; with a position open&lt;/td&gt;
&lt;td&gt;Orders cancelled, position closed, bot stopped, halt saved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Restart under a halt&lt;/td&gt;
&lt;td&gt;Restarted every container mid-halt&lt;/td&gt;
&lt;td&gt;The bot never resumed by itself&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Heartbeat silence&lt;/td&gt;
&lt;td&gt;Stopped the control service&lt;/td&gt;
&lt;td&gt;An independent watchdog alerted me within about 11 minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backup and restore&lt;/td&gt;
&lt;td&gt;Restored the ledger from off-site backups&lt;/td&gt;
&lt;td&gt;Data intact, integrity checks clean&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Full rebuild&lt;/td&gt;
&lt;td&gt;Destroyed and recreated the server from code&lt;/td&gt;
&lt;td&gt;Same IP, same data, still halted, in about 85 minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The drills also found real bugs before money was at stake. A firewall rule that Terraform reported as removed was still open. An environment variable silently re-enabled the exchange bot's own Telegram commands. A mistyped key ID made the server's private-network join fail without a clear error. Each became a fix and a test.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the evidence said
&lt;/h2&gt;

&lt;p&gt;No strategy survived real costs. At my exchange's real fee tier (0.80% per trade for small accounts, plus slippage), every candidate lost money, none beat random entries, and holding Bitcoin beat them all.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Strategy (Jan 2022 to Oct 2026, $100 start)&lt;/th&gt;
&lt;th&gt;Net result&lt;/th&gt;
&lt;th&gt;Max drawdown&lt;/th&gt;
&lt;th&gt;Beat random entries?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;BTC buy-and-hold (benchmark)&lt;/td&gt;
&lt;td&gt;+$75&lt;/td&gt;
&lt;td&gt;67%&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EMA cross, no stop (C05)&lt;/td&gt;
&lt;td&gt;−$61&lt;/td&gt;
&lt;td&gt;83%&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Baseline EMA cross with ATR stop&lt;/td&gt;
&lt;td&gt;−$65&lt;/td&gt;
&lt;td&gt;84%&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weekly momentum + volatility sizing (C04)&lt;/td&gt;
&lt;td&gt;−$30&lt;/td&gt;
&lt;td&gt;38%&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weekly momentum (C01)&lt;/td&gt;
&lt;td&gt;−$89&lt;/td&gt;
&lt;td&gt;92%&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three findings mattered more than any single number:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fees were the whole story.&lt;/strong&gt; An early four-month backtest showed +18%. Over two years it was −2.8% at old fee assumptions, and −46% once the real fee tier was verified.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sample size lies.&lt;/strong&gt; That +18% came almost entirely from three trades the backtest force-closed at the end of the data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Many tries manufacture luck.&lt;/strong&gt; If an AI proposes hundreds of strategies, the best one will look good by chance. The harness now registers every trial and compares each candidate against a random-entry baseline.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A lower-fee Canadian exchange improved one strategy enough to beat random entries for the first time, but it still failed at the exchange's true cost including spreads. That exchange also could not prove an API key was unable to withdraw, so it was rejected for live use.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;p&gt;The most valuable thing the system did was stop me from losing money on strategies that did not work. Five lessons carry well beyond trading:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Let AI propose, and let code decide.&lt;/strong&gt; The language model was most useful as a researcher and code reviewer, never as the decision-maker.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write the rules before the code.&lt;/strong&gt; Fixing the four capital rules first made every later design decision easy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drill your safety features.&lt;/strong&gt; Every drill I ran found something that tests alone had missed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model real costs from day one.&lt;/strong&gt; A fee assumption off by 3× turned a "promising" strategy into a steady loss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Publish negative results.&lt;/strong&gt; Most trading projects show only winners. An honest "it didn't work, and here is why" is rarer and more useful.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;Guarded Trader is open source under Apache-2.0 at &lt;a href="https://github.com/aplicy-com/guarded-trader" rel="noopener noreferrer"&gt;github.com/aplicy-com/guarded-trader&lt;/a&gt;. It runs in dry-run (paper trading) by default, and every runbook, drill result and failed backtest is in the repo.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Run it:&lt;/strong&gt; clone the repo and follow the dry-run quick start in the README. No exchange key or money needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contribute:&lt;/strong&gt; issues labelled "good first issue" are a good start. Strategy proposals must be pre-registered before they are tested.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Support it:&lt;/strong&gt; if the project saved you time or money, a star on GitHub helps others find it. You can also &lt;a href="https://buymeacoffee.com/aplicy" rel="noopener noreferrer"&gt;buy me a coffee&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;This is not financial advice, and nothing here shows a way to make money trading. It shows how to find out safely whether you can.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
      <category>cryptocurrency</category>
    </item>
  </channel>
</rss>
