Manual Backtesting Archives - Trading Heroes https://www.tradingheroes.com/tag/manual-backtesting/ Discover Your Grail Trading Strategy Tue, 12 Aug 2025 23:08:53 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 https://www.tradingheroes.com/wp-content/uploads/cropped-white-color-32x32.jpg Manual Backtesting Archives - Trading Heroes https://www.tradingheroes.com/tag/manual-backtesting/ 32 32 How to Manually Backtest Multiple Timeframes at the Same Time https://www.tradingheroes.com/manually-backtest-multiple-timeframes/ Thu, 25 Apr 2024 10:38:42 +0000 https://www.tradingheroes.com/?p=1025550 Learn how to have different timeframe charts open at the same time while you're backtesting. This is easy and will speed up the process.

The post How to Manually Backtest Multiple Timeframes at the Same Time appeared first on Trading Heroes.

]]>

In this tutorial, I'll show you how I backtest multiple timeframes at the same time.

You'll learn how to setup multiple charts and have them all run at the same speed while you backtest.

This is easy to do.

There are many software solutions that can do it, but it may not be obvious how to do it, if you don't know what to look for.

Here's what it looks like on my laptop.

Multiple timeframe backtesting

As you can see, I have the Daily, 4-hour, 1-hour and Weekly charts open.

Having multiple charts running at the same time has many advantages, which you'll learn about in this tutorial.

If you want to learn more about backtesting in general, be sure to read my backtesting guide on how to backtest in any market.

Alright, let's get into it…

Why Backtest Multiple Timeframes at the Same Time?

There are many reasons that you may want to have multiple timeframes open at the same time.

I feel that most traders will benefit from watching more than one timeframe when backtesting.

First, when you have multiple charts open at the same time, you don't have to flip back and forth between the different timeframes to check things like pivot points, trendlines or support/resistance levels on higher timeframes.

This alone can save you a ton of time.

Another reason to use multiple timeframes is that you can take trades on all of those timeframes.

Let's say that you want to backtest the same trading strategy on the Daily, 4-hour and 1-hour charts.

Having the ability to take trades on all of those charts at once will be much faster compared to testing each timeframe individually.

Now, I've personally found this a little hard to do in the past.

But if you have Rules setup on each of your charts, then you can have your backtest pause every time a trading setup condition happens.

Finally, you can not only test multiple timeframes at the same time, but you can also have charts of multiple markets running at the same time.

I'll get into multiple markets in another tutorial, but for now, let's take a look at how to setup the charts.

How to Setup a Backtest With Multiple Timeframe Charts

I'll demonstrate how to do this with NakedMarkets because that's what I use.

But the process will be similar, regardless of which software you use.

This method also works in Forex Tester and other software.

First, open NakedMarkets and start a new backtest.

New Backtest

Select the settings for your backtest, along with the market you want to test.

Backtest setup

Once you've finished the setups, you'll see a blank chart.

Blank backtesting screen

Now go to: File > Add new chart > [your current market]

This will add another chart.

Multiple charts open

If you want to add more timeframes, keep adding charts until you have all of the charts you want.

Then resize each chart so they all fit nicely on your screen.

You can also layer the charts if you want the charts to be bigger.

Now select each chart and change the timeframe to the one you want to display on that chart by clicking on the timeframe selectors in the toolbar.

backtesting timeframes

You can see the timeframe of each chart in the upper left corner of the window.

Chart timeframe display

Once you have setup the timeframes for each chart, select the timeframe that want to advance all of the charts at.

You can do this by selecting the Step timeframe in the toolbar, next to the Play button.

Backtesting steps

For example, if you select the 5-minute timeframe, all charts will advance in increments of 5 minutes.

Now click the Play button and the charts will move forward in unison, based on the timeframe that's currently selected in the Step setting.

To take a trade, simply right-click on any chart and enter a trade.

trading menu

Since all of the charts are moving forward at the same speed, it doesn't matter which chart you take the trade on.

Your trades will appear on all charts at the same time.

It's usually best to select a low timeframe in the Step setting because that will show you the greatest level of detail across all the charts.

Doing this will also help you see what candles look like on the the higher timeframe charts, before they close.

Many times, traders don't wait until a candle closes before taking a trade.

This can lead to impulsive trading.

Watching a candle unfold will help you understand the emotions that you can potentially go through as the candles develop.

Alright one last thing…

You can add Rules to each chart to take trades or simply pause the chart every time your setup happens.

To do this, simply drag the Rule you want to use from the folders on the left, onto the chart you want to use it on.

Drag Rule onto chart

Conclusion

Now you know how to do a backtest on multiple timeframes at the same time.

Using this method will save you a lot of time and help you find profitable trading strategies faster.

This can be done on many different backtesting platforms, so find out if your software can do it.

If your software can't do it, then consider using NakedMarkets.

It's what I use.

All that's left is to finish your first backtest.

Go for it!

 

The post How to Manually Backtest Multiple Timeframes at the Same Time appeared first on Trading Heroes.

]]>
Backtesting Limitations (Manual and Automated) https://www.tradingheroes.com/backtesting-limitations/ Tue, 09 Apr 2024 00:34:12 +0000 https://www.tradingheroes.com/?p=1025402 Learn the limitations of both automated and manual backtesting. Also discover tools and techniques that will help you overcome them.

The post Backtesting Limitations (Manual and Automated) appeared first on Trading Heroes.

]]>

Backtesting is the best way to verify that a trading strategy has an edge and optimize that strategy to meet your goals.

Despite its importance, backtesting does have its limitations.

The primary constraints of manual backtesting are that it requires discretionary input from the trader and is not highly scalable. Automated backtesting is limited by the quality of the code and it lacks flexibility. 

I've been backtesting since 2008 and it has helped me tremendously and has helped countless traders that I've met over the years.

My goal in this article is to help you understand the details of the limitations of the backtesting method you use, so you can minimize the negative impact they can have on your results.

These limitations apply to backtesting trading strategies in any market.

Alright, let's get into it…

Limitations of Manual Backtesting

Manual backtesting involves a trader simulating a trading strategy on historical data by manually checking whether each trade would have been a success or a failure according to the strategy's criteria.

This process requires the trader to scroll through past market data, apply the trading strategy rules, and record the outcomes of each hypothetical trade.

There are many software solutions that can dramatically speed up this process, or a trader can choose to simply record their results on a spreadsheet.

Here are the limitations of manual backtesting that you need to be aware of.

Human Discretionary Bias

Trader backtesting at desk

Arguably, the biggest limitation of manual backtesting is that human bias is introduced into the backtesting process.

This is not necessarily a bad thing however.

The benefit to manual backtesting is that it can test discretionary trading strategies, of which there are many more than automated strategies.

So if you backtest manually, the key to success is applying your logic consistently.

Even though you are making discretionary decisions, do your best to understand what a good trade looks like.

But even the most diligent trader will have some variability in their backtesting, so it's important to test the same strategy several times before trading it live.

It's also worth noting that since there is individual discretion in manual backtesting, results can vary greatly between traders.

Therefore, it's always best to test a strategy for yourself and not rely soley on the results of others.

Relatively Slow Process

Low speed

A big downside of manual backtesting is that it's inherently time-consuming.

You must painstakingly go through historical price data, applying a strategy's criteria to determine entry and exit points.

This process is not only slow but also prone to errors, as it relies heavily on your attention to detail and patience.

So when backtesting manually, it's important to focus on testing one strategy at a time.

The upside to this slower process is that you get a more detailed look at each trade and that can help you develop new optimizations faster than with automated backtesting.

Not Scalable

Since manual backtesting is slow, it cannot be scaled efficiently.

As traders seek to validate their strategies across different instruments, timeframes, and market conditions, the manual process becomes exponentially more cumbersome.

So if you're going to backtest manually, you have to be resigned to the fact that you'll only be able to test a few markets and timeframes at a time.

But this can be a blessing in disguise because it will allow you to become an expert in a few core markets, instead of a generalist in many markets.

Risk of Overfitting

Super profitable trading strategy

The second major limitation is the risk of overfitting.

Overfitting occurs when a strategy is too closely tailored to past data, making it perform exceptionally well on historical data but poorly in real-world trading.

Manual backtesting, with its reliance on subjective judgment, increases the risk of introducing biases into the testing process.

You may unconsciously select data that confirms the strategy's effectiveness or overlook data that contradicts it.

This selection bias can lead to over-optimistic results that do not accurately reflect the strategy's real-world performance.

Therefore, it's important to test your strategies on as much historical data as possible and not “cherry pick” the best performing periods.

Potential Miscalculations

Real-world trading involves factors such as slippage, transaction costs, and varying liquidity, which can significantly impact the profitability of a strategy.

Manual backtesting can oversimplify these aspects and make strategy look much more profitable than it really is.

Without a realistic representation of market conditions, the results of manual backtesting can be misleading, painting an inaccurate picture of a strategy's potential success.

To overcome this, always check that you're using realistic settings for things like commission, spread and slippage.

If these things are hard to factor in, you can always manually lower the return of your strategies slightly to account for unknown variables.

Limited Complexity

Another critical limitation of manual backtesting is the difficulty in testing complex or quantitative strategies.

If you're going to backtest discretionary trading strategies, you have to stick to methods that are simple and easy for you to calculate and execute.

Manual backtesting is not suited to handle high-frequency trading strategies or those that rely on complex analysis.

Although it may seem appealing to execute super complex, uber clever strategies, in my experience it's often the simple strategies that do best.

Limitations of Automated Backtesting

Automated or programmatic backtesting has revolutionized the way traders develop and evaluate their strategies, leveraging historical data to predict future performance without manual intervention.

By simulating trades based on specific criteria and algorithms, this method offers efficiency, precision, and the ability to test complex strategies across multiple datasets and timeframes.

Despite these advantages, automated backtesting is not without its limitations, which can impact the reliability of the results and the ultimate success of trading strategies.

Overfitting Risk

Office with blackboard and math equations

One of the primary challenges with automated backtesting is the risk of overfitting.

Overfitting occurs when a model is excessively complex, with numerous rules or parameters that are tailored to perform exceptionally well on historical data but fail to perform in the future.

This phenomenon leads to inflated backtest performance that cannot be replicated in live trading.

An example of this is the story of LTCM (Long-Term Capital Management), a hedge fund that relied heavily on complex mathematical models.

Despite the brilliance of its team, which included Nobel laureates, LTCM folded in 2000, due to a combination of excessive use of leverage and strategies that were overfit to past market conditions.

Look Ahead Bias

Another significant limitation is the “look-ahead” bias, which occurs when a strategy inadvertently utilizes future information in its trading decisions, leading to unrealistic backtest results.

This can happen through programming errors or when the data set includes future data not available at the time of trade execution.

The illusion of extraordinary returns generated by such biases can be misleading and result in substantial losses when the strategy is applied in real-time trading.

Trading Fees Miscalculation

Trading fees also present a hurdle for automated backtesting.

Historical data may not fully capture the market's liquidity, bid-ask spreads, and slippage that can significantly affect transaction costs and execution.

Automated backtests often assume ideal trading conditions, neglecting these real-world trading expenses.

This oversight can lead to an underestimation of costs and an overestimation of strategy performance.

Lack of Human Input and Intuition

Furthermore, the absence of human intuition and experience is a notable drawback of automated backtesting.

While automated systems excel in processing vast amounts of data and executing predefined strategies, they lack the ability to interpret nuanced market signals or adjust to unforeseen events.

In other words, they are only able to run the instructions they are given.

Famous traders like Jim Simons, the founder of Renaissance Technologies, have successfully combined automated trading with human oversight.

Simons, a mathematician, and his team developed sophisticated algorithms that have consistently outperformed the market.

However, the success of Renaissance Technologies also relies on continuous refinement of its models and the expert judgement of its team, highlighting the importance of blending automated strategies with human insight.

Technology Risk

Computer next to window

The dependence on technological infrastructure can pose serious risks.

Once an automated strategy is backtested, live trading requires robust computing resources, stable internet connectivity and continuous human oversight.

Since computer programs only follow instructions they are given, if certain scenarios are not accounted for, any failure in these systems can lead to significant losses, especially with high-frequency trading strategies.

One example is what happened to Knight Capital Group in 2012.

A glitch in their computer programs caused them to amass huge losses and almost sent them into bankruptcy.

Final Thoughts on Backtesting Limitations

Even though there are limitations to both manual and automated backtesting, there's no doubt that some sort of backtesting has to be done to verify and optimize trading strategies.

Risking real money on an untested strategy is like hiking in the mountains without a map.

You don't know a proven path, you're very likely to get lost on your hike and maybe not even make it back.

Therefore, the solution is to pick the backtesting method that best suits your skills and goals.

Then understand the limitations of your chosen method and minimize the negative impact of its limitations.

If you want to learn the tools and techniques for backtesting both manual and automated trading strategies, continue reading my tutorial on how to backtest a trading strategy.

 

The post Backtesting Limitations (Manual and Automated) appeared first on Trading Heroes.

]]>
How to Backtest a Trading Strategy in Any Market https://www.tradingheroes.com/how-to-backtest-a-trading-strategy/ Sat, 06 Apr 2024 05:06:10 +0000 https://www.tradingheroes.com/?p=1023943 Learn how to backtest a trading strategy and choose the best strategy for you. Get the tools, tips and techniques that pros use.

The post How to Backtest a Trading Strategy in Any Market appeared first on Trading Heroes.

]]>

Backtesting is the systematic process of finding out if a trading strategy has worked in the past and therefore will be very likely to work in the future. 

This is the most important step that a trader can go through to prove that their trading strategy actually works.

Yet, so many aspiring traders miss this vital step.

The best part about backtesting is that you don't necessarily need to know how to code to backtest.

There are many fantastic options for coders and non-coders alike.

So if you want to skip the pain of years of losing trades and blowing out accounts, keep reading to learn how to backtest a trading strategy in any market.

When you buy something through one of the links on our site, we may earn an affiliate commission.

Trading desk

Does Backtesting Really Work?

In my own personal experience and from reading the experiences of hundreds of traders since I started this website in 2007, the answer is a resounding YES.

But don't take my word for it.

Watch my interviews with professional traders who have gone on to manage funds and trade full-time for themselves.

Here's an example of one of my interviews.

In addition, there are countless trading books that prove that backtesting is the best way to master a trading strategy.

Think of it this way, would you buy a used car without test driving it first?

Of course not.

You need to test it out to see if it actually runs, if the air conditioner works, and that there aren't any weird noises.

So in a similar way, you need to take a trading strategy for a “test drive” and find out its strengths and weaknesses.

But there are many more benefits to backtesting.

The Benefits of Backtesting

Here are the main benefits that you'll get out of backtesting a trading strategy.

They are all very important for building your skills, proving that a strategy has an edge in the markets and optimizing a strategy.

Performance Assessment

Backtesting allows you to evaluate the effectiveness of a trading strategy by providing statistical data on its past performance, such as win rate, average profit per trade, drawdowns, and overall profitability.

It offers a risk-free environment to evaluate the potential of a strategy.

By analyzing historical data, you can gain insights into the strategy's return on investment (ROI) and risk profile.

This is particularly valuable in identifying which strategies are likely to be profitable and which are not, enabling you to make informed decisions about where to allocate your resources.

Risk Management

Worried man

Risk is one of the most important things to manage in trading.

A thorough backtest will provide the following information about the risk profile of a trading strategy:

  1. Understanding Risk/Reward Ratios: It helps in understanding the risk/reward ratio of a strategy by quantifying potential losses and gains. You can see not just the profitability but also how much risk is being taken to achieve that profit.
  2. Exposure to Market Conditions: Backtesting exposes a strategy to various market conditions, including high volatility periods, market downturns, and bull markets. Understanding how a strategy performs under these conditions helps you manage risk by knowing when a strategy might not perform well.
  3. Setting Risk Management Parameters: Based on backtesting results, you can set stop-loss orders, take-profit levels, and position sizes that align with your risk tolerance and capital preservation goals. This ensures that trades are exited at predetermined levels to minimize losses or protect profits.
  4. Statistical Analysis: It provides statistical measures of performance like the Sharpe ratio, drawdowns, and win rates. These metrics are essential for assessing the risk-adjusted returns of a strategy.
  5. Risk of Ruin: This shows how likely a strategy is to have a large drawdown or blow out the entire account.

Strategy Optimization

You can use backtesting to fine-tune your strategies by adjusting different parameters and rules to improve performance and adapt to different market conditions.

Through backtesting, you can identify the optimal settings for your strategy, such as stop-loss orders, entry and exit points, and position sizing.

Adjusting these parameters based on historical performance can help in refining a strategy to achieve higher returns or to minimize risk.

Confidence Building

Doubt is the kiss of death in trading.

A well-backtested strategy can give you confidence in your approach since you have historical evidence that your strategy has been profitable in the past.

If you don't have confidence in your trading strategy, you'll mess with good trades unnecessarily and you'll probably skip many profitable trades altogether.

Just like any great athlete has confidence in their skills, traders need to build confidence in their strategies to be successful.

When you've seen a setup hundreds of times in backtesting, taking a trade becomes a no-brainer because you know what a good trade looks like.

Identifying Market Conditions

A common question from new traders is: How do I know that the market is in a trend?

Well, you learn to identify any market condition through backtesting.

This could be a ranging market, trending market or anything else.

Once you've seen a particular type of market many times, you'll get a feel for what it looks like.

Reducing Overfitting

When you backtest a trading strategy over a wide range of historical data, you can identify if the strategy is overfitted to a specific period or set of conditions.

A robust strategy should perform well across different timeframes and market environments.

One common backtesting mistake that many traders make is they only backtest and optimize their strategy over a short period of time.

Then they try to trade it in current market conditions and they wonder why it doesn't work.

The reason that it doesn't work is because the strategy was optimized over, say 1 year, but that could have been an unusually good period for that strategy.

Over the entire history of that market, that could have been the absolute best time for that strategy.

I've personally seen this happen.

So if they try to trade that strategy at any other time, it will fail miserably.

Backtesting over a long historical period ensures that a strategy is robust enough to work in many different types of markets.

Save Time, Money and Reduce Stress

Clock on wall

Backtesting is much faster than waiting around for the markets to print candles in real time.

You can get decades worth of backtesting trades in as little as a few minutes.

Testing also allows you to evaluate a strategy without risking real capital.

More importantly, backtesting will save you the headache of jumping from strategy to strategy, while losing money along the way.

So even though it can be exciting to jump into real-money trading right away, that's always the longer route to success.

Backtesting first will seem longer initially, but is actually a shortcut. 

Emotional Discipline

Adhering to a strategy that has been rigorously backtested will make it easier to stick to your plan and make less impulsive decisions.

By testing and adhering to strategies that have shown promise in historical simulations, you'll avoid taking random, unproven trades based on emotions or market volatility.

This disciplined approach is crucial in maintaining consistency and achieving long-term profitability.

Types of Backtesting

There are 3 types of backtesting.

They will all get you a similar result, but the route you take to get that result will be different.

Each one has its benefits and downsides, so don't get too hung up on being able to do fully automated backtesting right away.

It sounds sexy.

But in reality, most people do better learning how to manually backtest first, then moving up the scale to automated backtesting…if they are so inclined.

Manual Backtesting

I feel that this is the place where most traders should start.

It's easy and anyone can do it.

Moreover, manual backtesting allows to you get very “intimate” with the data and every single trade.

In other words, you can see what each trade is doing on a very granular level and that can make it much easier to spot potential optimizations and errors.

Another benefit of manual backtesting is that most trading strategies cannot be fully automated.

There is often an element of discretion in most trading strategies, and therefore you'll have a lot more flexibility with manual backtesting.

You can use almost any trading platform to do manual testing, provided it has enough historical data.

Here's an example of a way that you can do manual backtesting for free.

Semi-Automated Backtesting

An intermediate step that not a lot of people talk about is semi-automated backtesting.

This is when you create scripts or automations that only manage part of your strategy, like the entry, the exit or the trade management.

Semi-automation allows you to speed up the backtesting process dramatically, while still being able to use the discretionary elements of a strategy.

It's a great compromise between manual and fully automated.

There are many ways to do this, but this example will get you started.

Automated Backtesting

Now we jump into fully automated backtesting.

To get the most out of this method, you'll probably have to learn how to code.

Learning to program will give you the most flexibility and allow you to control every aspect of a backtest.

There are no-code ways to do automated backtesting, but they do have their limitations.

Again, this reduces the number of strategies you can backtest because not all strategies can be turned into computer code.

Another downside is that it can be tough to see potential issues with a strategy because you aren't seeing every single trade on a chart.

But if you're a developer or engineer, this option might be very appealing to you.

There have been many successful automated traders, so don't let those facts discourage you.

The Turtles are a good example of very successful traders who use automated strategies.

How to Backtest a Trading Strategy Step-By-Step

Regardless if which method you use to backtest a trading strategy, the process is always going to be the same.

These are the steps to do your first backtest.

Step 1: Pick One Market and Timeframe

There is a misconception among many new traders that a trading strategy will work equally well in any market and on any timeframe.

Not true.

So it's best to pick one market and timeframe that you'll master, before moving on.

How do you pick the best ones?

That's a very individual choice.

There's no “best” trading market or timeframe for everyone, only the ones that you're most comfortable with.

So take some time to learn about different markets and pick the one that appeals to you the most.

Backtesting on the 4 hour chart or higher is fairly straightforward.

But day trading strategies are a little more involved so learn the details here.

Step 2: Learn Trading Strategies for Your Market

There are countless posts on forums like Reddit that show a chart and ask: Is this a good trade?

That's always painful to read because it's obvious that the person doesn't know anything about trading strategies.

Just like basketball players have their favorite moves for getting the ball in the hoop, traders need to have their favorite trading strategies to extract profit from the markets.

The fastest way to find a trading strategy to test is to see what successful traders are doing in the market you've selected.

Like with choosing a market, choosing a trading strategy will be very individualized to you.

Find a strategy that makes sense to you and that looks easy to test.

It also helps to adopt a curious mindset.

Many times traders can get too wrapped up in finding the most profitable strategy.

I've certainly been there.

But if you approach strategy selection from the standpoint of having a feeling that a strategy will work, and being genuinely curious about the results, I believe that you'll get much further than if you just look for maximum profit.

Step 3: Create a Complete Trading Plan to Backtest

Journaling at night

Once you have a general strategy idea, it's time to turn that into a complete trading plan.

It helps a lot to write that plan down because you can reference it throughout your backtesting sessions.

When you don't have a written plan, it's too easy to stray from the plan and take random trades.

If you take random trades, you won't know how well your plan really works.

Define every element of your plan like:

  • Entry criteria
  • Exit criteria
  • Trade management criteria
  • Risk per trade
  • When you trail your stop loss or move it to breakeven
  • Maximum number of open trades at the same time
  • If you're going to take trades in correlated markets or not

An easy way to get started is to download my free trading plan worksheet.

Step 4: Choose Your Software and Get Historical Data

Backtest a trading strategy with NakedMarkets

Before you start testing, make sure that you have access to a lot of historical data for your chosen market.

At least 20 years of data is a good place to start.

This will determine which backtesting software or programming language you'll use.

I provide some software suggestions in the next sections.

The best software for you will depend on the market your trading.

But for now, just know that you have to test your trading plan in some sort of software platform.

You can also download historical data from third party data providers and upload it to your software.

So if you like a software solution, but it doesn't have enough data, just know that this option is available.

Step 4: Backtest

Backtesting computer

Alright, now it's time to backtest!

Start up your backtesting software and take trades according to your plan.

Most backtesting platforms will have instructions on how to do your first test.

Obviously I cannot list instructions for every single platform and programming language out there because it would make this article way too long.

So it's up to you to find the instructions for your platform.

Many people also make tutorials on YouTube, so that's another great resource.

When backtesting on the 4 hour chart or higher, then backtest with all of the data you have available.

That's fairly straightforward.

The shorter timeframes are a little harder to test.

It's not always possible to backtest all of the data because there is just too much to backtest.

In this case, pick a few different market conditions like:

  • Ranging markets
  • Strongly trending markets
  • Weakly trending market
  • Highly volatile markets

It helps to zoom out to a higher timeframe to see these types of markets.

For example, if you're backtesting on the 15 minute chart, zoom out to the 4 hour chart to see the overall market conditions.

Then within each of those periods, test a couple of years.

These “spot checks” will give you a good idea of how your strategy performs under different market conditions and if you should continue testing or not.

If your results are favorable, then you can do more in-depth backtesting.

Step 5: Review the Statistics

Trading strategy results.

When you have completed a full backtest, review the results to see if the strategy has potential.

You can use a simple Excel spreadsheet to do your calculations.

Even better, if the software you're using has built-in analytics, that will save you a lot of time.

What you're looking for will depend on your goals.

Some traders look for total return, others look for consistency, and others value low risk.

Ask yourself what you value most and make that your goal. 

Step 6: See if the Results can be Optimized

Backtesting results graph

Spoiler alert: Most backtests will have mediocre or losing results.

But don't get discouraged.

Almost all trading strategies will have to be tweaked and optimized to work well. 

That's the nature of the beast.

So be willing to experiment and try different ideas. 

Here are some ideas for optimizing the results of your strategy:

  • Experiment with different indicator settings
  • Trail your stop loss
  • Target a smaller profit target
  • Target a larger profit target
  • Split your profit targets
  • Tighten your stop loss
  • Make your stop loss larger
  • Add an additional indicator or criteria to enter or exit
  • Don't trade on days or at times that have a high percentage of losses

Just be careful of over optimizing a strategy.

This is when you make a trading strategy work very well for the backtesting period, but it doesn't perform well in other periods.

To avoid this, it helps to split your data up into in-sample and out-of-sample data.

In other words, leave some data out of your optimization process so you can backtest on it to see if your strategy will work well in a period that hasn't been optimized for.

For example, let's say that you have 20 years of data on the daily chart.

You could backtest and optimize on 15 years of data.

Then see how that strategy works on the remaining 5 years of data that you didn't optimize for.

This is easier to do on shorter timeframes because there is much more data.

Doing this one extra step can help you understand how well your strategy will work in the future.

Step 7: Decide to Keep or Trash the Strategy

trash can

Once you've done all of the potential optimizations you can think of and the strategy still isn't as profitable as you would like, then it's time to trash the idea and move on.

That's usually very obvious.

What isn't as obvious is when a strategy is slightly profitable.

If that's the case, then test the trading strategy on multiple timeframes and multiple stocks, futures contracts or currency pairs.

Adding more trading opportunties can create a more favorable return.

You might also consider trading a portfolio of different strategies.

Each one on its own might not have a fantastic return.

But when traded together, they could be very profitable.

Backtesting in Different Markets

Each trading market has its own nuances and best practices when it comes to backtesting strategies in that market.

So now I'll give you the benefits and downsides to each market.

I'll also provide some tools and tips that can help you backtest more efficiently in each market.

Backtesting in Forex

In my experience, Forex is the easiest market to backtest.

There are only a set number of markets and some currency pairs have a long history.

The data is also easy to get and usually pretty clean.

It's also the most liquid market in the world, so there's very low slippage.

Transaction costs are also low on the major pairs.

My favorite backtesting software is NakedMarkets because it has free updated data and I can build semi-automated and fully automated strategies with the no-code interface.

Backtesting Indexes

Indexes like the S&P 500 are also easy to backtest because they have one continuous chart that goes back a long time.

To trade indexes, you can use futures, ETFs, or any other product that tracks an index.

Ease of backtesting will vary depending on which derivative you trade, but they can be a great market to trade.

I've seen some traders make a very good living just trading the S&P500 E-mini.

Great backtesting platforms are TradeStation, NinjaTrader or NakedMarkets.

Backtesting Stocks

Bull on Wall Street

Stocks are harder to backtest than other markets because there is a huge universe of individual stocks listed on any stock exchange.

I'm also going to group ETFs into this category because they are traded in a similar way to stocks.

On the upside, there are always many trading opportunties because there are so many stocks available to trade.

I use Amibroker, but there are many other platforms out there like TradeStation.

You can also do automated backtesting with programming languages like Python.

Backtesting Futures

Like in Forex, futures are fairly easy to backtest because there are a limited number of markets.

The biggest downside is that futures contracts expire, so there will always be a slight “jump” in the data when there is a contract change.

On top of that, you can trade different expiration months in the same contract, which can create some confusion.

Therefore, the easiest way to backtest futures is to find data that uses a continuous chart of the front month, or the contract that is going to expire the soonest.

This is usually the most liquid contract, making it less likely that you'll get choppy price action and unreliable backtesting results.

It can also help to backtest each contract individually to eliminate some of the discrepancies that can come when one contract expires and the next contract kicks in.

I've tried to backtest futures, but I found it too frustrating to navigate the contract changes.

However, there are obviously many successful futures traders out there, so don't get discouraged if you really like this market.

The premier backtesting platform for futures is TradeStation, but there are many other ones out there like NinjaTrader.

Backtesting Crypto

Since crypto is an easy market to backtest, there are many software packages that can backtest this market.

The biggest downside is that crypto is a fairly new market, so you won't have much data to test with.

Therefore, you might be better off trading a lower timeframe, or using a scale in / scale out approach.

Many markets also don't have a lot of liquidity, so you're generally better off testing the major ones like Bitcoin, Litecoin and Ethereum.

An upside to backtesting crypto is that there are very noticeable boom and bust cycles, making it somewhat easier to build strategies around.

I suggest using NakedMarkets to backtest cryptocurrencies.

Backtesting Options

Backtesting options is much different from other markets because of the way the contracts are structured and how strategies are constructed.

I'm not an expert in options, so the information here is from my research and not personal experience.

One thing that makes options hard to backtest is that there are different types of options: vanilla, binary, one-touch, double no-touch, American, European, etc.

European vanilla options are the most common, so that's generally best to start there.

Since these options can only be exercised at maturity, it provides fewer variables in backtesting.

Popular backtesting platforms are tastylive and OptionAlpha.

How Far Back Should You Backtest a Trading Strategy?

Backtesting at laptop

The short answer is that you should backtest as far back as possible, and with as much data as possible.

You want to see how the trading strategy performed in as many market conditions as possible.

A common meme on the internet is that you need to backtest a minimum of 100 trades to prove that a strategy works.

That's a myth.

As I detail here, the amount of trades you need to prove a trading strategy will depend on the strategy and trading timeframe.

Final Thoughts on Backtesting

So that's how to backtest a trading strategy in any market.

Remember that there's no best strategy or market for everyone.

The best combination will depend on your trading personality and what you like best.

So don't look for the “most profitable” strategy and market.

Pick the ones that make the most sense to you.

Note: You may notice that I've left a popular backtesting tool off the list, TradingView.

fThis is a fantastic platform for doing many things, but backtesting is not one of them.

You'll need to buy their higher plans to get the Deep Backtesting feature, which gives you access to more data.

In my opinion, it's not worthwhile, at least at this point in time.

 

The post How to Backtest a Trading Strategy in Any Market appeared first on Trading Heroes.

]]>