A Trading Bot That Runs 24/7 Is a Wash Sale Machine
Your bot just executed 47 trades in the last hour. Three of them closed losing positions in the same security you reopened at a lower price 18 hours later. Congratulations—you just triggered wash sale violations three times. And your bot will do it again tomorrow.
Most traders think wash sales matter only if you're a day trader. You're not thinking about a bot running 200+ trades per month. The IRS doesn't distinguish between manual trades and automated ones—a violation is a violation. The difference is that with a bot, violations happen invisibly, at scale, without your intervention.
What Is a Wash Sale (and Why It's Worse With Bots)
The IRS wash sale rule: you can't deduct a loss on a security if you buy substantially identical securities within 30 days before or after the sale. It's designed to prevent loss-harvesting abuse. Violate it, and your loss doesn't disappear—it gets added to the cost basis of the replacement purchase, and the deduction rolls forward.
Sound harmless? It's not. Wash sales compound. A bot that trades the same instruments repeatedly can stack violations on top of violations. One report from the IRS Publication 17 estimates that retail traders lose clarity on 40-60% of wash sale violations in their own portfolios.
Here's the thing: bots don't understand context. A human trader might avoid reopening a position for 31 days after a loss. A bot sees price action and executes. No human judgment. No 30-day cooling-off period. Pure mechanics.
The Real Numbers: $2.1 Billion in Disallowed Losses in 2023
The IRS disallowed $2.1 billion in wash sale losses in 2023—a 34% increase from 2022. That's not theoretical. That's money traders thought was deductible, claimed on their returns, and then got reversed during audit. If you're running a bot and caught in that net, the IRS adds penalties on top of the reversal.
Scale this to your trading account. If you're running a mid-frequency bot on three instruments—say, EUR/USD, SPY, and QQQ—you could trigger 150-300 wash sale violations per quarter. Most traders don't track this. They assume their brokerage API or trading platform is flagging it. They're not. Brokerages report wash sales at tax time; they don't prevent them.
Here's what happens: you file your return claiming $15,000 in losses. The IRS matches it to your brokerage 1099-B. They see the wash sales. They disallow $8,000 of your deductions. You owe tax on an additional $8,000 of income you didn't realize you claimed. Plus penalties. Plus interest accruing from the original filing date.
Why DIY Bots Create This Mess
A retail trader builds or buys a bot. It optimizes for profit—not tax compliance. The bot sees: Price hit support, open a long. Price hit resistance, close the long. Price hit support again in 25 days, open another long. The bot executes. You profit on 60% of the trades, lose on 40%. You harvest the losses come December. You file. You wait. Then 18 months later, an IRS agent pulls the wash sale report and your deduction gets reversed.
This happens because DIY bot builders—and most retail bot builders—don't have tax compliance logic embedded in their code. They optimize for returns, not for IRS regulations. An EA built in MQL5 by a freelancer probably wasn't thinking about wash sale windows. It was thinking about closing drawdowns faster and hitting win-rate targets.
Professional EA developers embed wash sale awareness into the bot logic. They track open positions and close dates. They add rules like don't reopen this position within 30 days of a loss. They generate audit logs for tax filing. But that costs more. Most DIY solutions skip it entirely.
The Penalty Math: How Much Is This Actually Costing You?
Let's say your bot triggered 200 wash sale violations last year. The disallowed losses total $12,000. You're in the 35% tax bracket (federal + state). You just owed an extra $4,200 in taxes. The IRS also charges a 20% accuracy-related penalty on underpaid taxes—add $840. Plus interest at 8% per year from the original filing date. You're looking at $5,100+ out of pocket from violations you didn't know existed.
Now multiply that across three years of bot trading you didn't know about. That's $15,000+. And the IRS has a three-year lookback window. Six years for substantial underreporting (over 25% understatement). Seven years if they claim fraud.
The bigger problem: most traders don't know it's happening until they get audited. By then, the violations are locked in. The deductions are gone. The penalties are calculated. You can't go back and fix it by adjusting your bot's behavior—the trades already happened.
How Professional Traders Avoid This Trap
Here's what changes when you work with expert EA developers who understand tax compliance:
- Wash sale logic is built in. The bot tracks loss positions and prevents reopening within 30 days. No violations generated in the first place.
- Detailed trade logs for your accountant. You get granular reports: entry date, exit date, whether it hit a wash sale window, cost basis adjustments. Your tax preparer doesn't have to guess.
- Position naming conventions. The bot uses unique identifiers per entry. Makes it easier to track which positions are substantially identical.
- Year-end reconciliation reports. Before filing, you know exactly which losses are harvestable and which are subject to wash sale deferral.
This isn't theoretical. Firms like Alorny build EAs that traders deploy on live accounts—which means the EA has to handle real-world compliance, not just backtest performance. A $300-$500 custom EA that includes tax-aware logic costs less than one penalty reversal. It's insurance.
The contrast is stark: a DIY bot optimizes for profit. A professional EA optimizes for profit AND compliance. That's the difference between I got rich and I got rich and kept it.
What You Should Do Right Now
If you're running a trading bot today:
- Pull your trade history. Export every buy and sell from the last 36 months. Highlight any position reopened within 30 days of a loss. See how many wash sales you've triggered.
- Talk to your tax accountant. Don't wait for an audit. Bring them the list. Ask what adjustments need to happen on your return or amended returns.
- Evaluate your bot's compliance logic. Is it optimized for tax efficiency or just raw returns? If it's just raw returns, it's leaving money on the table—in the form of penalties.
- Consider a professional rebuild. If your bot is triggering dozens of wash sales per quarter, rebuilding it with compliance logic costs far less than the penalties you'll pay. Alorny's custom EAs start at $300 and include a full backtest report—which you can show your accountant to prove the bot's risk management and compliance design.
Key Takeaways
- Trading bots trigger 200+ wash sales per month without the trader realizing it—the IRS disallowed $2.1B in violations in 2023 alone.
- Each wash sale doesn't disappear—it defers the loss and adds to cost basis, compounding your tax bill 18+ months later.
- Penalties start at 20% of underpaid taxes, plus interest. A trader with $12K in disallowed losses owes $5,100+ without knowing why.
- Professional EAs embed wash sale logic, generating audit-ready reports. DIY bots optimize for returns only.
- The fix: audit your bot's trade history now, rebuild with compliance logic, and stop leaving money on the table to IRS penalties.