<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joe Tay on Medium]]></title>
        <description><![CDATA[Stories by Joe Tay on Medium]]></description>
        <link>https://medium.com/@joetay_50959?source=rss-79a4e1513a77------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*f05taUvOisZuFCvRnRztOQ.jpeg</url>
            <title>Stories by Joe Tay on Medium</title>
            <link>https://medium.com/@joetay_50959?source=rss-79a4e1513a77------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 20:05:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joetay_50959/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[From Failed Experiments to 43.8% APR: How I Finally Built a Profitable Trading Bot with AI]]></title>
            <link>https://medium.com/@joetay_50959/from-failed-experiments-to-43-8-apr-how-i-finally-built-a-profitable-trading-bot-with-ai-64771995d38c?source=rss-79a4e1513a77------2</link>
            <guid isPermaLink="false">https://medium.com/p/64771995d38c</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[crypto-trading]]></category>
            <category><![CDATA[cryotocurrency]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[bots]]></category>
            <dc:creator><![CDATA[Joe Tay]]></dc:creator>
            <pubDate>Tue, 09 Dec 2025 05:55:56 GMT</pubDate>
            <atom:updated>2025-12-09T05:55:56.099Z</atom:updated>
            <content:encoded><![CDATA[<h3>A four-year journey of persistence, failures, and an unexpected breakthrough with Generative AI</h3><p>It’s December 2025, and I’m staring at my Raspberry Pi humming quietly in the corner of my room. This unassuming device is running a trading bot that has achieved a 43.8% annual return since I deployed it in August. Over those four months, the account balance climbed from $2,241 to $2,546, with a maximum drawdown of just 12.3%.</p><p>But this isn’t a story about overnight success or get-rich-quick schemes. This is a story about four years of copying broken code, running failed experiments, getting big losses, and nearly giving up — until everything finally clicked.</p><h3>The Beginning: Medium Articles and Copy-Paste Dreams (2020–2022)</h3><p>I discovered Medium in 2020, and like many people, I became obsessed with the idea of passive income. Articles with titles like “I Built a Trading Bot That Makes $500/Day” or “How I Automated My Way to Financial Freedom” filled my reading list. The promise was intoxicating: write some code, let it run, and watch the money roll in while you sleep.</p><p>So I did what any eager beginner would do — I copied code from these articles and tried to run them. The results were predictably disastrous. Most scripts threw errors immediately. The ones that did run either lost money or made trades so nonsensical I had to manually intervene. I tried strategies I barely understood: moving average crossovers, RSI indicators, Bollinger Bands. Each one seemed promising in theory but failed spectacularly in practice.</p><p>What these articles didn’t mention was the unglamorous reality of algorithmic trading: the importance of proper risk management, the impact of trading fees, the complexity of market microstructure, and the countless edge cases that break your logic. I was learning, but progress was painfully slow.</p><h3>The ChatGPT Era: Lower Barriers, Same Problems (2023–2024)</h3><p>When ChatGPT launched in late 2022, I thought my problems were solved. Here was an AI that could write code for me, explain trading concepts, and help debug my errors. The barrier to entry suddenly felt much lower.</p><p>And it was — sort of. ChatGPT could generate clean, working code. It could explain why my previous attempts failed. But it couldn’t solve the fundamental problem: I still didn’t have a profitable strategy. The AI was a better coding assistant, but it wasn’t a trading genius. Garbage strategy in, garbage results out.</p><p>I tried dozens of strategies: grid trading, arbitrage, momentum trading, mean reversion using Python on Streamlit. I backtested everything obsessively. Some strategies looked great in backtests but fell apart when I traded them live losing money most of the time. Others never even passed basic backtesting.</p><p>The frustration mounted. I had learned and was quite good at building bots and applications. I understood technical indicators. But I still couldn’t make money consistently.</p><h3>The Turning Point: Early 2025</h3><p>By early 2025, I bought a Raspberry Pi, because I did not want to pay for cloud servers, I started developing quick and simple trading bots without the fancy GUI within the Rasberry Pi server. I also changed my approach towards experimentation, instead of immediately deploying strategies with real money, I committed to rigorous backtesting first. No more jumping into live trading with half-baked ideas.</p><p>I spent months backtesting different approaches on historical data from the beginning of 2025 through July. Different indicators, different timeframes, different risk management rules. Most still failed to show consistent profitability.</p><h3>The Breakthrough: August 2025</h3><p>Then came August 2025, and everything changed.</p><p>I was working with Claude, asking it to help me design a new trading strategy. Instead of the complex multi-indicator systems I had been obsessing over, it suggested something elegantly simple: a Donchian Channel breakout strategy.</p><p>The logic was straightforward. The Donchian Channel tracks the highest high and lowest low over a given period. When price breaks above the upper channel, it signals potential upward momentum. When it breaks below the lower channel, it signals potential downward momentum. The strategy has been around since the 1970s, originally developed by Richard Donchian for commodity trading.</p><p>I was skeptical. How could something this simple work when all my complex systems had failed? But I ran extensive backtests anyway, and for the first time in four years, I saw something that made me sit up: consistent positive returns across different market conditions and timeframes.</p><p>I spent weeks refining the parameters, optimizing the position sizing, and testing edge cases. The backtests held strong. This wasn’t curve-fitting — the strategy showed robustness across different market regimes.</p><p>But backtests had fooled me before. The real test would be live trading with real money.</p><p>On August 1st, 2025, after months of preparation and learning from past liquidations, I deployed the bot using this strategy with real money and proper risk management in place. And this time, it actually started making money.</p><h3>Enter Agno: The AI Risk Manager (November 2025)</h3><p>By November, I had a profitable strategy, but I noticed something troubling. Occasionally, the bot would enter a losing streak that would give back several days of gains. The Donchian strategy was sound, but it needed better risk management.</p><p>That’s when I introduced Agno, an AI agent I built to monitor the bot’s performance and intervene when necessary. Agno’s job is simple but crucial: watch every trade, analyze the market context, and cut losses when the risk/reward ratio turns unfavorable.</p><p>Agno doesn’t make trading decisions — it acts as a safety net. Think of it like a copilot that can take the controls if the main pilot is heading into a storm. The agent monitors API data, evaluates drawdowns in real-time, and can override the main strategy if conditions warrant.</p><p>I optimized the Donchian parameters dynamically. Instead of static channel periods, the system now adapts based on recent market volatility. This adaptive approach reduced the maximum drawdown from over 20% in my early tests to the current 12.3%.</p><p>The results speak for themselves. Here’s the complete picture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UhjaiCB9mzcNRh-Qx1zB8A.png" /></figure><p><strong>Full Year 2025 Metrics (Including Backtesting Period):</strong></p><ul><li>Annual Percentage Return (APR): 16.1%</li><li>Total Return: 15.0%</li><li>Maximum Drawdown: -21.2%</li><li>Initial Balance: $2,187.26</li><li>Final Balance: $2,514.47</li><li>Days Tracked: 341</li><li>Trading Days: 96 (mostly August onwards)</li><li>Idle Days: 245 (backtesting and development period)</li></ul><p>The full year chart tells an important story. From January through July, the account sat mostly idle while I focused on backtesting and development. You can see the massive idle period on the timeline. The real action began in August when I deployed the Donchian strategy with real money.</p><p>Here’s a closer look at the active trading period from August through December:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HP-qIkRqczUDRNLzw_f-Qw.png" /></figure><p><strong>Active Trading Period (August — December 2025):</strong></p><ul><li>Annual Percentage Return (APR): 43.8%</li><li>Total Return: 13.6%</li><li>Maximum Drawdown: -12.3%</li><li>Win Rate: 34.3%</li><li>Total Trades: 845</li><li>Days Traded: 128</li></ul><p>The difference in APR (43.8% vs 16.1%) shows why the timeframe matters. The 43.8% represents the actual returns during active trading. The 16.1% is diluted by months of idle time during the development phase. Both numbers are real, but they tell different parts of the story.</p><p>You might notice the win rate is only 34.3%. That’s lower than you’d expect for a profitable system, right? This is where risk management matters. The winning trades are significantly larger than the losing trades, creating a positive expectancy despite the lower win rate. It’s not about being right most of the time — it’s about making more when you’re right than you lose when you’re wrong.</p><p>More importantly, the -12.3% maximum drawdown during the active trading period is dramatically better than the -21.2% I experienced earlier in the year. This improvement came from two key factors: better strategy selection and the addition of Agno for AI-powered risk management.</p><h3>The Algorithm: A High-Level Overview</h3><p>I’m not going to share the exact implementation (sorry, but this is the secret sauce), but I can share the conceptual framework:</p><pre>DONCHIAN BREAKOUT STRATEGY (Pseudocode)</pre><pre>// Parameters (dynamically optimized)<br>lookback_period = adaptive_function(recent_volatility)<br>position_size = calculate_position_size(account_balance, risk_per_trade)<br>stop_loss_multiplier = 1.5<br>take_profit_multiplier = 2.0</pre><pre>// Entry Logic<br>upper_channel = highest_high(lookback_period)<br>lower_channel = lowest_low(lookback_period)</pre><pre>if current_price &gt; upper_channel AND no_position:<br>    enter_long(position_size)<br>    set_stop_loss(entry_price - (ATR * stop_loss_multiplier))<br>    set_take_profit(entry_price + (ATR * take_profit_multiplier))</pre><pre>if current_price &lt; lower_channel AND no_position:<br>    enter_short(position_size)<br>    set_stop_loss(entry_price + (ATR * stop_loss_multiplier))<br>    set_take_profit(entry_price - (ATR * take_profit_multiplier))</pre><pre>// Agno Risk Management Layer<br>agno_monitor():<br>    if current_drawdown &gt; threshold:<br>        evaluate_market_regime()<br>        if market_regime == &quot;unfavorable&quot;:<br>            close_position()<br>            pause_trading(cooldown_period)<br>    <br>    if consecutive_losses &gt; limit:<br>        reduce_position_size()<br>        increase_selectivity()</pre><p>The real edge isn’t in this basic framework — it’s in the details of how the parameters adapt, how Agno evaluates market context, and how the system handles various edge cases that emerge in live trading.</p><p><strong>CRITICAL DISCLAIMER: Futures trading is extremely risky and not suitable for everyone. I’ve been liquidated multiple times throughout this journey, losing significant portions of my trading capital. Leverage can amplify both gains and losses exponentially. This article documents my personal experience and is NOT financial advice. Never trade with money you can’t afford to lose, and always implement proper risk management systems to prevent liquidation.</strong></p><h3>What I Learned</h3><p><strong>AI is a tool, not a magic solution.</strong> Generative AI didn’t give me a profitable strategy on a silver platter. They helped me explore ideas faster, debug code more efficiently, and understand concepts more deeply. The breakthrough came from combining AI assistance with my own accumulated knowledge from years of failed experiments.</p><p><strong>Simpler is often better.</strong> My most complex strategies failed. The Donchian Channel is elegantly simple, and that simplicity makes it robust. There are fewer things to break, fewer parameters to overfit, and clearer logic to debug when something goes wrong.</p><p><strong>Risk management is everything. </strong>It doesn’t matter how good your strategy is if one bad trade can wipe out your account. Proper position sizing, stop losses, and leverage management aren’t optional — they’re the difference between surviving and being liquidated. The Agno monitoring system exists specifically to prevent the catastrophic losses I experienced in my early trading days.</p><p><strong>Win rate doesn’t equal profitability.</strong> A 34.3% win rate seems low, but with proper position sizing and risk/reward ratios, it’s more than enough to be profitable. Protecting your downside is more important than maximizing your upside.</p><p><strong>Backtesting must come before real money.</strong> The months I spent backtesting from January to July 2025 weren’t wasted time — they were essential preparation. Every previous strategy I deployed without thorough backtesting failed. The Donchian strategy worked because I tested it exhaustively before risking real capital.</p><p><strong>Persistence pays off.</strong> Four years is a long time to work on something without consistent results. There were moments I wanted to quit, especially after days of losing trades. But every failed experiment taught me something, and those lessons accumulated until the breakthrough finally came.</p><h3>This is Just Part 1</h3><p>I’m calling this “Part 1” because the journey isn’t over. The next challenge is figuring out what to do with this system. Do I scale it up with more capital? Do I build multiple strategies and diversify? Do I explore monetization options like offering signals or API access?</p><p>I’m still figuring that out. For now, I’m focused on keeping the system running smoothly and continuing to learn. The Raspberry Pi keeps humming, the trades keep executing, and the account balance keeps growing.</p><p>And if anyone wants to buy the algorithm for $20 million USD, my DMs are open. (I’m joking. Mostly.)</p><p><strong>What’s your experience with algorithmic trading or AI-assisted projects? Have you had similar journeys of persistence paying off after years of failure? I’d love to hear your stories in the comments.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64771995d38c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>