What the IRS Says About Wash Sales
A wash sale happens when you sell a security at a loss, then buy the same or substantially identical security within 30 days before or after the sale. (IRS Publication 550 explains the rule; this overview shows real examples.) The IRS disallows the loss deduction. The 33-day window (30 days plus the purchase/sale date) is the legal threshold.
Sounds simple. But "substantially identical" is vague. Is a $500 put option on SPY substantially identical to SPY shares? What about two similar EAs that trade the same strategy? The IRS has broad authority here, and ambiguity favors them.
Why DIY Bots Are Wash Sale Factories
DIY traders typically use free code, open-source libraries, or Fiverr developers. Almost none of these implementations track the wash sale window. The bot sees three consecutive losing trades on EUR/USD. It executes an exit and re-entry. The calendar flips. Forty days later, the bot buys back EUR/USD.
To the bot, this is smart risk management. To the IRS, this is a textbook wash sale. The bot doesn't know the rule. The trader doesn't know the rule. The tax accountant discovers it in March of the following year when reconciling all trades.
Then the problems start.
The IRS Penalty: Back Taxes, Penalties, Interest
Let's say your bot triggered wash sales totaling $80,000 in disallowed losses. Here's what you owe:
- Back taxes on the disallowed loss: $80,000 × your tax rate (22-37% federal). That's $17,600 to $29,600 just in federal income tax.
- Accuracy-related penalty: 20% of the underpayment. Another $3,520 to $5,920.
- Interest: Calculated from the original due date. The IRS charges 8% annually (compounded quarterly). Two years of unpaid tax? Add $2,560 to $4,800 in interest.
- Audit fees and legal: If the IRS audits (and wash sales almost always trigger audits), you'll spend $5,000-$15,000 on accountants and lawyers explaining yourself.
Total: $28,000 to $55,000 for an $80,000 loss you didn't know you were creating.
The Invisible Nature of Wash Sales in Automated Trading
Manual traders can avoid wash sales. You track your losses. You know which positions you exited at a loss. You wait 33 days before re-entering.
Automated traders can't. A bot executing 50+ trades per day across multiple pairs doesn't have a human checking the calendar. It doesn't ask "did we just exit a losing EUR/USD position?" A good bot tracks this. A DIY bot doesn't.
This is the gap. DIY bots are so efficient at executing trades that they're equally efficient at executing tax violations.
Why Custom Bots Solve This (And DIY Doesn't)
A proper EA or trading bot includes wash sale logic in the codebase. Before a trade is placed, the bot checks: Did we exit a similar position at a loss in the last 33 days? If yes, the trade is blocked or the loss carryover is adjusted.
This isn't magic. It's a data structure (a log of closed positions + exit prices + dates) and a lookup function (before each new trade, check the log). A developer spending an hour can implement this. A DIY coder spending zero dollars on compliance builds it anyway.
Alorny includes wash sale compliance logic in every EA we build. We log every trade, every loss, every 33-day window. Your bot runs clean. Your tax return stays clear.
The Cost of Compliance: What Most Traders Miss
The real cost of DIY bots isn't the initial build—it's the audit aftermath. You pay back taxes. You pay penalties. You lose sleep. You might face criminal charges if the IRS determines you evaded taxes knowingly (though this requires intent).
A custom bot that costs $300-$500 eliminates this risk entirely. You're not just buying automation. You're buying a tax shield.
Think about it: an $80,000 wash sale violation costs $28K-$55K to settle. A $300 bot that prevents wash sales has a 100x ROI just by avoiding one violation. Most traders face 5-10 violations per year. The math is obvious.
How to Check if Your Current Bot Is Compliant
Ask your bot's developer or provider these questions:
- Do you track closed positions and their exit dates?
- Do you check the 33-day wash sale window before placing new trades?
- Can you export a full trade log with dates, prices, and loss/gain amounts?
- Have you documented the compliance logic?
If the answer to any of these is "no," your bot is a wash sale risk. Our bots pass all four checks—compliance is built in, not bolted on.
Key Takeaways:
- Wash sales occur when you sell at a loss and buy substantially identical securities within 33 days. The IRS disallows the loss deduction.
- DIY trading bots don't track wash sale windows. They execute trades based on signals alone, not tax rules.
- A single $80K wash sale violation costs $28K-$55K in back taxes, penalties, and interest. Plus audit fees.
- Custom bots include compliance logic. Before each trade, the bot checks the 33-day window and adjusts accordingly.
- Compliance is not an afterthought. It's a feature worth hundreds of thousands of dollars over your trading lifetime.
What To Do Next
If you're running a DIY bot, export your last year of trades and manually check for the 33-day wash sale patterns. If you find violations, contact a tax attorney immediately—the sooner you file amended returns, the lower the interest accrual.
Going forward, move to a bot that tracks compliance from day one. Send us your strategy and we'll build the exact EA your account needs, with wash sale logic baked in. Starting from $300. Message us on WhatsApp and tell us what you trade.