How to Backtest a Trading Strategy Like a Fool

I woke up this morning and grabbed a cup of coffee, then just for fun, I decided to type how to back test into YouTube.

I was curious to see how much more advanced the younger generation was at systematic trading.

The results for me were like fingernails on a chalkboard...

Only trade with you test - or you're a fool!

More...

How to Backtest - Why Do It at All?

Backtesting is, of course, how you verify your trading rules will make money.

If your rules don't make money in a simulation, they aren't going to magically start making money in the real world.

A properly tested trading system has data you hold back ("out-of-sample") from the simulation.  

Next you run your rules on the out-of-sample data and hope it looks like the in-sample data:

How to backtest a trading strategy

Example of a Properly Backtested Trading Strategy

Searching YouTube for "how to backtest", I figured to see simple mistakes in the videos like failing to confirm a strategy on historical data hidden from the computer.

But nothing prepared me for this.

How to Backtest by Hand - Don’t Do It!

All the top videos were of guys and gals dragging their charts across the screen and "backtesting" by hand.

I wanted to reach through the computer and slap them silly.

That's not how to backtest!

It's the blind leading the blind out there.

People literally believe playing connect the dots with trend lines is how you make money in the markets.

I explained this to my buddy, and he believes that if enough people say it on the news, then it must be true.

No wonder there was so little progress until the scientific method.

That's where people started thinking in terms of evidence rather than consensus.

Einstein's Theory of Relativity was crapped on by 100 scientists.

They sent him a letter telling him how wrong he was.

To add extra clout to the message, they all signed it.

Albert's response: "Why 100? If I were wrong, one would have been enough."

Meaning that all it takes is one piece of evidence to debunk his theory.

Science Isn’t a Popularity Contest


If I received a document signed by 100,000 people saying the earth is flat, I'll find their leader and park his fat ass next to Bezos in the next launch of his phallic-shaped rocket.

It's like American Airlines finding the shortest people, and asking them what they thought about the leg room.

OK, ok, I'll climb down off my soapbox for a minute.

Let's talk about how to backtest today and how it helps mint millionaires and a few billionaires.

How to Backtest: Use a Computer

First of all, it's just plain lazy not to have a computer do the backtesting for you.

According to Wikipedia, humans have a TON of biases.

One of them is ignoring losing trades when you wing it and backtest by eye.

I'm guilty of this kind of backtesting decades ago, and it cost me not only the money I lost, but the money I could have gained from implementing a proven strategy.

I didn't just lose $20k, I probably lost millions in opportunity over those years.

I wandered aimlessly from technique to technique.

When you setup a few trading rules, the next step is to find the optimum settings for trading indicators.

What most fail to do is hide a portion of the historical data from the computer.

That's to confirm you have a real edge in whatever you're trading, and not over-fitting to the past.

It's insane that some platforms with 100's of thousands of users don't have out-of-sample testing capability.

Any strategy built without out-of-sample-testing is immediately suspect as it probably will lose money.

Curve Fit Swing Trading System

A Trading System Built Without Using Out-of-Sample Data

How to Backtest (Even Better): Multiple Out-of-Sample Areas

Another tip on how to backtest even better is to have multiple areas hidden from the optimization process.

If you have a big hunk of recent historical data that's unseen by the computer, you'll probably have the wrong settings to maximize profits.

That's because markets drift over time.

But by breaking your test into several different sections, you'll likely boost performance considerably.

That's like adding high octane fuel instead of 87 regular.

Here's that being tested on my Slugger trading system:

How to Backtest a Trading System

Slugger: A Trading System Tested Using Multiple Out-of-Sample Areas

Let's dive deeper now...

Look around the trading landscape and what do you see?

The most popular software platforms are at large brokers like TD-Ameritrade, Think or Swim, and a few others.

Their testing capability goes mostly like this:

  • Choose a symbol like SPY
  • Start testing price indicators like MACD and RSI to see what works
  • Optimize the crap out of the settings

Houston, we have a problem!

This technique is being used by at least a million traders. 

It has been practically mined dry!

Tip: Try Backtesting a Basket of Stocks, Not Just One

Here's a hot tip if you've made it down this far.

Traders are leaving gobs of profits on the table by not including "portfolio ranking" in their trading systems.

That's where you have a basket of stocks...like the entire NASDAQ 100...and you just trade the top 10.

You could rank by highest momentum over the past few months -- that's a good starting place.

Like the Billboard Hot 100 ranks by highest sales.

Most trading platforms have at least a million people are using them.

This makes it damn near impossible to discover edges that aren't based on price of a single symbol.

How to Backtest: Conclusion

  • Almost everyone is back testing their trading systems wrong by not using out-of-sample data
  • Using multiple out-of-sample data areas accounting for shifting markets is the key
  • Finally, make sure you test your trading strategy with this exact formula

About the Author

Hello! I'm Kurt the "Relaxed Trader" writing the stuff on this website. Feel free to ask me questions. I love talking to fellow traders that want to use computers to beat the stock market. Shoot me an email: Kurt@relaxedtrader.com

Leave a Reply 0 comments