Master

Going live with a system

Running a strategy on real money is nothing like running it on old data. Markets react to you, orders fill imperfectly, and your own psychology becomes a factor again. The safe path is to go live small and watch everything fall apart before it costs much.

What you will see

Backtest fill: $100.00 Live fill: $100.18 Slippage on 1000 shares: $180.00

About 2 min of reading

Try It

Running on real money is nothing like a backtest: fills are imperfect and slippage quietly destroys an edge. I set a kill switch that stops the system after a bad day and show exactly how an eighteen-cent gap per share compounds into a whole loss.

1

I print a kill switch that flattens every position and stops the system once the daily loss limit is blown, removing the human temptation to hope.

max_daily_loss = 2000.0 daily_loss = 2500.0 print("Going live with a system") if daily_loss > max_daily_loss: print("Kill switch: flattening all positions") print("Stopped") else: print("Trading normally")

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Going live with a system Kill switch: flattening all positions Stopped
A system that knows when to quit outlives one that sits and hopes. The discipline is the point, not the strategy itself.
2

I compare the optimistic backtest fill to the honest live fill and multiply the gap by the shares traded to show how slippage quietly eats the edge.

backtest_fill = 100.00 live_fill = 100.18 shares = 1000 print("Backtest fill: $%.2f" % backtest_fill) print("Live fill: $%.2f" % live_fill) print("Slippage on %d shares: $%.2f" % (shares, (live_fill - backtest_fill) * shares))

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Backtest fill: $100.00 Live fill: $100.18 Slippage on 1000 shares: $180.00
Eighteen cents per share is nothing. Times it by a thousand shares every day and it becomes a whole loss by year end.

Put it in order

Before you write anything, put these lines back in the right order. Click a line to move it up one step. This support step is easier than writing code from scratch, and it is here to make the last example stick.

Data Flow

A strategy moves from backtest to paper trading to small real money, with a kill switch that stops it if anything goes wrong.
1 Backtest
↓
2 Paper trade
↓
3 Trade small
↓
4 Grow slowly or stop
Why this works
Execution reality

In a backtest you buy at the exact closing price. In live trading your order fills at whatever price the market happens to offer right now, which can be worse, especially in a thin market. Slippage and fees quietly change the whole result.

Watch and stop

A live system needs a kill switch. If it starts drifting from its plan or blows past a loss limit, stop it. No strategy survives forever, and knowing when to turn one off is its own kind of skill.

Examples

The ladder to live trading

1. Backtest on history
2. Paper trade live for weeks
3. Trade tiny real money
4. Grow size slowly

Each rung proves the idea works one more step away from the safe, controlled world of a backtest. Skipping steps feels efficient until the real market shows you exactly how much you skipped, and it wasn't cheap.

Watching slippage eat your edge

Backtest fill: $100.00
Live fill:     $100.18

Eighteen cents on a share looks like nothing. Times it by a thousand shares and a few trades a day and it compounds into a whole loss over a year. Backtest fills are optimistic by convention; live fills are honest. Watching the difference is the difference between a plan and reality.

Setting a kill switch

if daily_loss > max_daily_loss:
    flatten_all()
    alert('stopped')

A kill switch stops the system automatically after a bad day. It removes the human temptation to sit there and hope a losing strategy magically recovers. The discipline is the point: a system that knows when to quit outlives one that doesn't.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← Factor investing
Previous Lesson
Factor investing
Next Lesson
Optimization and its dangers
Optimization and its dangers →