My first algo lost $3,000 in 4 hours. It was a simple mean reversion strategy that looked great in backtesting. 68% win rate, steady profits, beautiful equity curve.
Then I turned it on with real money and watched it buy every single dip in a market that was actually crashing. No stop loss. No position limits. Just pure, automated stupidity.
That expensive lesson taught me what this guide will teach you for free: how to actually get started in algorithmic trading without lighting your money on fire.
What Algo Trading Actually Is (Not What YouTube Tells You)
Forget the lambos and the "I made $50K in one day" thumbnails. Real algorithmic trading is writing code that loses money slightly less often than it makes money, multiplied by thousands of trades.
Here's what actually happens:
- You write rules: "Buy when RSI < 30 and MACD crosses up"
- Computer executes those rules 24/7
- You make tiny profits per trade (think $5-50, not $5,000)
- Volume and consistency create returns, not home runs
The pros at Jane Street aren't making genius predictions. They're making markets a penny wide and doing it a million times a day.
Why 2025 Is Different (And Why That Matters)
Everyone's jumping into algo trading now because the barriers finally fell:
Free APIs Everywhere: Alpaca, IBKR, even Robinhood (finally) has APIs. No more $10K/month data fees.
Python Won: Forget C++. Libraries like pandas and backtrader mean you can prototype strategies in hours, not weeks.
Compute Is Cheap: $5/month VPS can run your algo. My first setup in 2015 cost $500/month for worse performance.
Retail Got Smart: The days of "buy low sell high" Reddit strategies are over. Now everyone's backtesting.
The Only 3 Things Your Algo Actually Needs
After building dozens of strategies, I've learned every algo boils down to three parts:
1. Entry Signal (When to Buy)
Skip the fancy ML stuff. Start dead simple:
- Golden Cross: 50-day MA crosses above 200-day MA
- RSI Oversold: RSI drops below 30
- Gap Down: Stock opens 3%+ below previous close
My most profitable algo? Buys SPY when it gaps down >1% on above-average volume. That's it. One rule. Makes money.
2. Exit Rules (When to Sell)
This is where beginners screw up. You need THREE exit rules:
- Take Profit: Exit when you're up X%
- Stop Loss: Exit when you're down Y%
- Time Stop: Exit after N days regardless
That crashed algo I mentioned? No stop loss. Don't be me.
3. Position Sizing (How Much to Buy)
The Kelly Criterion says bet 2×(win rate) - 1. Ignore that. Here's what actually works:
- Risk 1% of account per trade maximum
- Scale down in volatility (VIX > 30? Half position)
- Never have >5 positions open
Professional secret: Position sizing matters more than entry signals. Bad entries with good sizing survive. Good entries with bad sizing blow up.
Your First Real Algorithm (That Actually Works)
Forget moving average crossovers. Everyone tries them first. Here's what I give beginners that actually makes money:
# The "Monday Morning Dip Buyer"
def should_buy(stock):
if day_of_week != 'Monday':
return False
if current_price < friday_close * 0.98: # Down 2%+ from Friday
if volume > avg_volume * 1.5: # On high volume
return True
return False
def position_size(account_value):
return account_value * 0.02 # Risk 2% per trade
def exit_rules(position):
if profit >= 3%: sell()
if loss >= 2%: sell()
if holding_days >= 3: sell()
Why this works: Weekend news creates overreactions. Monday morning panic selling often reverses by Wednesday. Simple, logical, profitable.
The Tools That Actually Matter in 2025
Forget Everything Except These:
For Backtesting:
backtrader(Python) - Just works, tons of examplesQuantConnect- Free tier, but their docs suck- Excel - Seriously. Test ideas here first.
For Live Trading:
Alpaca- Best free API, works instantlyIBKR- More markets but clunky setupTD Ameritrade- Good for options algos
For Data:
yfinance- Free Yahoo data, good enough to startPolygon.io- When you need real-time data- Your broker's API - Usually free with account
The Mistakes That Will Kill Your Account
Learn from my expensive education:
Overfitting (The Silent Killer) You backtest a strategy. 73% win rate! Then live trading: 45% win rate. What happened? You optimized for past noise, not future signal.
Fix: If your strategy has >3 parameters, you're probably overfitting.
Ignoring Slippage Backtest assumes you buy at exact prices. Reality: By the time your order hits, price moved. On a $100 stock, that's $0.10-0.30 per trade. Kills tight strategies.
Fix: Add 0.1% slippage to all backtest trades. Still profitable? Good.
The Penny Problem "My algo makes $0.50 per trade!" Cool. Alpaca charges $0.00. IEX charges $0.0009. Your internet hiccups and you miss the exit: -$500.
Fix: Minimum profit target = 10× your total transaction cost.
Going Live Too Fast Everyone does this. Backtest looks good, paper trading works, YOLO real money. Then you discover your code had a bug that bought 10,000 shares instead of 100.
Fix: Paper trade for minimum 30 days. Boring but necessary.
Your 90-Day Learning Path (That Actually Works)
Days 1-30: Learn One Thing Well
Pick Python + yfinance + backtrader. That's it. Build 5 stupid simple strategies:
- Buy SPY on red days, sell on green days
- Buy the worst performer of the Dow 30
- RSI below 30, sell above 70
Don't worry about profits. Learn the tools.
Days 31-60: Backtest Everything
Take your 5 strategies. Backtest 2010-2020. Add transaction costs. Add slippage. Watch them all lose money. This is good - you're learning what doesn't work.
Now modify them. Add stops. Add filters (only trade when VIX < 20). One will show promise.
Days 61-90: Paper Trade Like It's Real
Put $10K fake money in Alpaca. Trade your best strategy. Keep a journal:
- Why did it enter?
- Why did it exit?
- What went wrong?
After 30 days, you'll know if you're ready for real money.
Real Talk: What You'll Actually Make
Everyone wants to know the number. Here's the truth from someone who's been doing this:
Year 1: You'll lose money. Not maybe. Will. Budget -$2,000 for education.
Year 2: Break even. Your wins finally offset your losses + costs.
Year 3+: 10-20% annually if you're good. 20-30% if you're exceptional.
My returns after 5 years? 17% annually. Not sexy, but it compounds. That friend who claimed 200% returns? He blew up his account in 2022.
Your Homework for This Week
Stop reading. Start doing. Here's your exact homework:
Monday: Install Python and yfinance. Pull SPY data for 2023.
Tuesday: Calculate 20-day moving average. Plot it.
Wednesday: Code "buy when price crosses above MA" logic.
Thursday: Add position sizing (risk 1% per trade).
Friday: Backtest on 2023 data. Calculate your Sharpe ratio.
If you can't do this in a week, algo trading isn't for you. Harsh but true.
One Final Warning
Algo trading attracts people who think they're smarter than the market. The market has been humbling smart people since before computers existed.
Start humble. Stay humble. The market doesn't care about your PhD or your elegant code. It cares about risk management and discipline.
My crashed $3,000 algo? Best tuition I ever paid. It taught me the market's most important lesson:
You're not that smart, but if you're careful, you don't need to be.
