<?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: Andres Munoz</title>
    <description>The latest articles on DEV Community by Andres Munoz (@and54).</description>
    <link>https://dev.to/and54</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%2F4250086%2F7eb07af6-e5f5-4e81-98bc-fed7a14dee1c.png</url>
      <title>DEV Community: Andres Munoz</title>
      <link>https://dev.to/and54</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/and54"/>
    <language>en</language>
    <item>
      <title>My trading bot's best feature is saying no</title>
      <dc:creator>Andres Munoz</dc:creator>
      <pubDate>Tue, 17 Nov 2026 15:47:34 +0000</pubDate>
      <link>https://dev.to/and54/my-trading-bots-best-feature-is-saying-no-35c2</link>
      <guid>https://dev.to/and54/my-trading-bots-best-feature-is-saying-no-35c2</guid>
      <description>&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;Since August 2026, a Raspberry Pi Zero 2 W has been running a trading bot I built. It trades stocks, ETFs and crypto through the Alpaca brokerage API, checks the market every 5 minutes, and runs 24/7 as a systemd service with a Wi-Fi watchdog so it recovers on its own.&lt;/p&gt;

&lt;p&gt;It only trades on paper. No real money. That was a deliberate choice, and so was most of what I want to talk about here: not the part that buys, but the part that refuses to.&lt;/p&gt;

&lt;p&gt;The stack is TypeScript, Node.js and Express on the backend, React for the dashboard, SQLite for storage and Jest for tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two simple strategies
&lt;/h2&gt;

&lt;p&gt;The bot is rule-based. There's no LLM and no machine learning in the signals, and I wanted it that way: every trade should be something I can explain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stocks and ETFs: momentum.&lt;/strong&gt; The bot works from a fixed list of 21 symbols. It ranks them by blended trailing returns over 140, 160 and 180 days, holds the top 10, and sells a holding when it drops to rank 14. That gap between 10 and 14 keeps it from selling something the moment it slips one spot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Crypto: SMA 20/50 crossover.&lt;/strong&gt; A classic moving average crossover, on pairs I chose because they have low correlation with each other.&lt;/p&gt;

&lt;p&gt;Neither strategy is new. The interesting part is everything around them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that says no
&lt;/h2&gt;

&lt;p&gt;Before any order reaches the broker, it has to pass risk rules that live in the code, not in my head:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Size caps.&lt;/strong&gt; Every order and every position is capped as a percentage of equity.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hold times.&lt;/strong&gt; Minimum hold times keep the bot from tripping pattern day-trading rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A rank-aware stop-loss.&lt;/strong&gt; The stop-loss respects the momentum ranking instead of fighting it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A separate step to arm live trading.&lt;/strong&gt; Switching from paper to real money is not a config flag the bot can flip. It needs its own deliberate step.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since August 4, the bot has made 94 order attempts. Its own rules blocked 37 of them.&lt;/p&gt;

&lt;p&gt;That number is the one I like most. A bot that does everything its signals say is easy to build. A bot that checks itself before acting is the one I'd actually trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing my own results
&lt;/h2&gt;

&lt;p&gt;I built an offline backtesting tool and an analytics dashboard (equity curve, drawdown, exposure, profit per symbol), then used them to compare more than 10 strategy changes.&lt;/p&gt;

&lt;p&gt;Most of my ideas didn't survive. I rejected 8 of them based on the results, including trailing stops and a wider list of symbols. Ideas that sounded smart on paper made things worse in the data.&lt;/p&gt;

&lt;p&gt;Then I found a problem in my own numbers. My symbol list was picked with today's knowledge, so the backtest was quietly favoring companies I already knew had done well. When I retested on a historical S&amp;amp;P 100 list instead, survivorship and selection bias showed up in my results. Whether the strategy beat buy-and-hold also depended on the start date I picked.&lt;/p&gt;

&lt;p&gt;That's why I don't lead with a return number when I talk about this project. The honest result is the testing process, not a headline figure.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I took from it
&lt;/h2&gt;

&lt;p&gt;Put the limits in code. Rules you only keep in your head get skipped the first time a trade looks exciting.&lt;/p&gt;

&lt;p&gt;Make the dangerous switch hard to flip. Going live should take a separate, deliberate step.&lt;/p&gt;

&lt;p&gt;Test against yourself, not just against the market. The bias I found wasn't in the strategy. It was in how I picked the data.&lt;/p&gt;

&lt;p&gt;I write about this and my other projects on my portfolio: &lt;a href="https://andresmunoz.app/" rel="noopener noreferrer"&gt;andresmunoz.app&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;How do you test your own assumptions on side projects?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is a personal project running on paper trading only. Nothing here is financial advice.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>node</category>
      <category>raspberrypi</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
