What is a Backtest in Stock Market Trading?

Stock Market Guides is not a financial advisor. Our content is strictly educational and should not be considered financial advice.

At Stock Market Guides, we talk a lot about backtests. We regularly mention how the trading strategies featured in our stock picking service have a “backtested edge”. It can be helpful to know what a backtest is.

When we run a backtest, what we’re doing is taking a given trade strategy and looking back at history to see how it may have performed in the past.

 

How Do You Run a Backtest?

To run a backtest, we first need to write the strategy in a coding language. In other words, we have to create an algorithm.

Stock Market Guides

stock market guides logo

Stock Market Guides identifies stock and option trading opportunities that have a historical track record of profitability in backtests.

Average Annualized Return
This takes the average return in backtests of all the stock picks featured in this service and annualizes it.

79.4%

Learn More

Backtesting Platforms

The coding language you use for writing your strategy will depend on which platform you use for performing your backtests.

We created our own in-house backtesting software for doing some of our own research, but we also like using TradeStation for backtesting. You have to learn their proprietary coding language, called EasyLanguage, which we found intuitive.

You could also use the Python coding language to do backtesting.

Some trading platforms have backtesting modules in them, although they often don't offer as much flexibility for backtesting since they only accommodate out-off-the-box backtests.

Fine-Tuning a Trading Strategy for Backtesting

For a backtest to be effective, the trading strategy you test needs to have very clearly defined rules for the entry and exit of the trade. That’s what allows us to check every time that a stock or option would have triggered an entry or exit historically for a given trading strategy.

Here is an example of a trading strategy:

Buy the stock the first time the price goes down 10% from its one-year high. Sell the stock after a period of 3 months.

That has a precise set of rules for the entry and the exit. If you aren't precise with the trade strategy rules, you won't be able to run a backtest.

For example, you can't backtest a strategy that calls for a trade entry when the stock's price is "near" the prior day's closing price. That's not precise enough.

It has to be very precise. Is it within 1% of the prior day's closing price? Within $1.00? Does it matter if it's above or below that closing price?

And what will cause the trade to end? Will there be a stop loss? A profit target? A time limit for the trade?

These are the things that have to be accounted for when writing an algorithm that can be backtested.

 

How We Use Backtests at Stock Market Guides

Backtesting is the key research vehicle we use for our product offerings here at Stock Market Guides.

Our backtests use a look-back period of more than 20 years, which includes all sorts of different market cycles. Our goal is to make sure we feature trading strategies that can stand up to the test of time.

The process we use for running a backtest is intensive in many ways:

  1. First we have to write the code to define the strategy.

  2. Then we have to run the backtest on each ticker we want to test. If we want to run the test against 2,000 stock tickers, we have to run the backtest 2,000 times. Since the backtesting process is so time-consuming, we have an entire team dedicated just to running backtests.

  3. Once we have a backtest that seems good on the surface, then we run it through a litany of statistical tests. Many seemingly promising trade strategies get discarded at this stage.

It’s important to know that backtests are not a live trading record. Click here to learn about the limitations of using backtests.

Join Our Free Email List

Get emails from us about ways to potentially make money in the stock market.

Stock Market Guides

stock market guides logo

You can trade without an edge, but why?

What We Offer

Stock Market Guides identifies stock and option trading opportunities that have a historical track record of profitability in backtests.

Average Annualized Return
This takes the average return in backtests of all the stock picks featured in this service and annualizes it.

79.4%

Learn More