Back to website
Backtesting Basics Backtesting Key Performance Indicators (KPIs)
8 mins read

Backtesting Trading Strategy Configuration & Examples

Developing a successful trading strategy requires more than just a hypothesis and a set of rules. It necessitates thorough testing and validation to ensure its effectiveness in real-market conditions. Backtesting, a vital component of this process, allows traders to simulate their strategies using historical data and evaluate their performance.

In this article, we delve into the world of strategy testing, focusing on how TrendSpider’s Strategy Tester can be utilized to validate and optimize trading approaches. We will explore the steps involved in configuring a strategy, creating hypotheses, defining entry and exit conditions, and selecting appropriate backtesting settings. We will also go over some example trading strategies and their parameters.

Configuring a Trading Strategy

To configure a trading strategy for backtesting, you’ll need to follow a systematic process that involves creating a hypothesis and defining entry and exit conditions based on that hypothesis. Here’s a step-by-step guide:

Create a hypothesis

Creating a hypothesis is a critical step when configuring a trading strategy for backtesting. It involves formulating a belief about how the market will behave based on observations and analysis. A hypothesis serves as the foundation for your strategy, providing a clear direction and rationale for your trading decisions.

When creating a hypothesis, it’s essential to thoroughly understand the market you wish to trade. This entails studying historical price data, identifying trends, and examining relevant indicators or patterns that may influence market movements. By gaining this knowledge, you can develop a hypothesis that aligns with the observed behavior of the market.

Your hypothesis should outline the strategy you intend to employ and the conditions that will guide your entry and exit decisions. For example, you might hypothesize that when the price breaks above a specific moving average, it signifies an upward trend. In this case, your strategy would involve entering long positions when such a breakout occurs.

Select backtesting settings

When selecting backtesting settings in TrendSpider’s Strategy Tester, you have several options to customize the analysis according to your trading strategy and preferences. Here’s an overview of the key settings and their significance:

  1. Chart Type: The chart type determines how the price data is represented visually during backtesting. TrendSpider offers various chart types, including Generic OHLC (Open, High, Low, Close), Raindrop, Heikin-Ashi, and Line charts. Each chart type has its own characteristics and can provide different insights into price action. Choose the chart type that best aligns with your trading style and the type of analysis you want to perform.
  2. Timeframe: The timeframe selection determines the granularity of the historical data used in the backtest. TrendSpider allows you to choose timeframes ranging from 1 minute to monthly charts. The timeframe you select depends on your trading strategy and the frequency of your trades. Shorter timeframes are suitable for day trading or scalping strategies, while longer timeframes are more appropriate for swing or position trading.
  3. Analysis Depth: The Analysis Depth setting in TrendSpider’s Strategy Tester determines the level of detail used in the analysis. It provides different levels of market data for backtesting, including Chart, Shallow, Medium, and Deep. The deeper the analysis depth, the more historical data will be considered, which can be useful for identifying long-term trends and patterns. Choose the analysis depth that aligns with the timeframe and trading strategy you are testing.
  4. Trade By Price: Trade By Price allows you to specify the price level used for executing trades during backtesting. You can choose from options such as Open, High, Low, Close, or various averages. This setting determines the price at which your simulated trades will be executed based on your entry and exit conditions. Select the price level that best reflects your intended trading approach and strategy.

When selecting backtesting settings, it’s important to ensure that they align with your trading strategy and goals. Consider the timeframe and chart type that best represent the market you want to trade, and choose the analysis depth that provides sufficient historical data for accurate testing. Additionally, selecting the appropriate trade execution price level will ensure realistic simulations of your trading strategy.

Keep in mind that the chosen settings can significantly impact the results of your backtest, so it’s essential to carefully consider each setting and its implications for your strategy’s performance.

Define entry conditions

Defining entry conditions based on your hypothesis is a crucial aspect of configuring a trading strategy. TrendSpider offers a wide range of parameters and conditions that you can utilize to specify when to enter a trade. Here’s an overview of the process and available options:

  1. Hypothesis and Strategy: Start by referring to your hypothesis, which outlines your belief about market behavior. Identify the specific conditions that, according to your hypothesis, indicate a favorable entry point for a trade. This could be based on technical indicators, price patterns, or any other factors that support your hypothesis.
  2. Selecting Parameters: In TrendSpider’s Strategy Tester, you have the flexibility to add a theoretically unlimited number of parameters to define your entry conditions. Parameters are the specific conditions you set for your trading strategy. These conditions can be based on price, candlestick patterns, or various indicators available on the platform.
  3. Choosing Conditions: When adding a parameter, you can select from a range of conditions provided by TrendSpider. These conditions include “greater than,” “less than,” “increased,” “decreased,” “crossed,” “crossed up,” or “crossed down” in relation to an indicator or constant level. These conditions allow you to define specific thresholds or events that trigger your entry signal.
  4. Setting Thresholds and Levels: Depending on the condition you choose, you will need to specify the relevant thresholds or levels. For example, if you select the condition “greater than” for a moving average indicator, you would specify the value above which the price needs to be for the condition to be met.
  5. Combining Multiple Parameters: TrendSpider enables you to combine multiple parameters to create complex entry conditions. You can add multiple conditions and specify whether all conditions need to be met (AND logic) or if any one of them is sufficient (OR logic) to trigger an entry.

By utilizing the available parameters, conditions, and logical operators in TrendSpider, you can design precise and customized entry conditions that align with your hypothesis. This allows you to systematically identify trade setups that meet your criteria for entering a position.

Define exit conditions

Defining exit conditions is a crucial component of configuring a trading strategy. These conditions determine when you should exit a trade to lock in profits or cut losses. In TrendSpider’s Strategy Tester, you have several options for defining exit conditions, including script, number of candles passed, take profit, and stop loss. Here’s a breakdown of each option:

  1. Script Condition: The script condition in TrendSpider allows you to add parameters to define custom exit conditions. Similar to the entry conditions, you can specify conditions based on price, candlestick patterns, or indicators. By using scripting capabilities, you have the flexibility to create advanced and specific exit rules that align with your trading strategy.
  2. Number of Candles Passed: This condition enables you to set a specific number of candles that need to pass before an exit is triggered. For example, you may decide to exit a trade if it hasn’t reached your target or stop loss after a certain number of candles. This condition provides a time-based element for determining when to exit a trade.
  3. Take Profit: The take profit condition allows you to set an exit point when your trade has reached a specific profit level. You can specify the desired profit as a percentage gain. You have the option to exit when the candle closes or immediately at the given level. Take profit conditions enable you to secure profits when your trade meets your predefined targets.
  4. Stop Loss: The stop loss condition helps protect your capital by defining an exit point when your trade has incurred a specific loss. Similar to take profit, you can set the stop loss as a percentage loss. You can choose to exit when the candle closes or immediately at the given level. Stop loss conditions help limit potential losses and manage risk in your trading strategy.

By utilizing these exit conditions in TrendSpider’s Strategy Tester, you can establish clear rules for when to exit trades. These rules ensure that you have a systematic approach to both capitalizing on profitable trades and limiting potential losses.

Test and refine

Once you have configured your trading strategy in TrendSpider’s Strategy Tester, you can initiate the backtesting process. This involves running the strategy on historical price data to simulate trades and track performance. The tool will generate hypothetical trading results based on your defined entry and exit conditions.

During backtesting, it’s crucial to analyze key performance indicators (KPIs) to evaluate the effectiveness of your strategy. KPIs may include metrics such as profit and loss, win rate, average gain/loss, maximum drawdown, risk-reward ratio, and others. These indicators provide insights into the profitability, risk management, and overall performance of your strategy.

It’s essential to test your strategy on various timeframes, assets, and samples to ensure its robustness and adaptability. By testing on different timeframes, you can assess how your strategy performs in different market conditions and trading styles. Similarly, testing on various assets helps determine if your strategy is effective across different markets. Additionally, testing on different samples of historical data can provide insights into the strategy’s performance in different market regimes.

Backtesting is an iterative process. After analyzing the results and KPIs, you may need to refine your strategy to improve its performance. This may involve adjusting entry and exit conditions, optimizing parameters, or adding additional filters or indicators. Refinement is an ongoing process that helps you adapt your strategy to changing market conditions and increase its potential for profitability.

It’s important to backtest your strategy multiple times until you feel comfortable with its performance and reliability. Consistently achieving satisfactory results across different scenarios and timeframes can instill confidence in your strategy. However, it’s crucial to remember that even a well-performing backtest does not guarantee future success. Continual monitoring, adaptation, and real-time testing are necessary for maintaining and refining your strategy.

Example Backtesting Trading Strategies

Below are some example trading strategy configurations for backtesting in TrendSpider’s Strategy Tester. Visit the links to view each strategy’s performance and to import the strategy to your TrendSpider account.

Accumulation/Distribution Line Bullish

"Accumulation/Distribution Line Bullish" strategy by ILuvMarkets
charts.trendspider.com
“Accumulation/Distribution Line Bullish” strategy by ILuvMarkets

Accumulation/Distribution Line Bullish is a long strategy created by ILuvMarkets on TrendSpider.

Entry conditions (all of the following on the daily chart):

  1. The Accumulation/Distribution Line increased.
  2. The Accumulation/Distribution Line increased one candle ago.
  3. The price closed higher than the 20-period Exponential Moving Average (20 EMA).

Exit conditions (all of the following on the daily chart):

  1. The Accumulation/Distribution Line decreased.
  2. The Accumulation/Distribution Line decreased one candle ago.
  3. The price closed lower than the 20 EMA.

Chaikin Oscillator Bullish Breakout

"Chaikin Oscillator Bullish Breakout" strategy by ILuvMarkets
charts.trendspider.com
“Chaikin Oscillator Bullish Breakout” strategy by ILuvMarkets

Chaikin Oschillator Bullish Breakout is a long strategy created by ILuvMarkets on TrendSpider.

Entry conditions (all of the following on the daily chart):

  1. The Chaikin Oscillator (9, 21) crosses up above zero.

Exit conditions (all of the following on the daily chart):

  1. The Chaikin Oscillator (9, 21) is less than zero.

ATR Trailing Stop Bullish Breakout

"ATR Trailing Stop Bullish Breakout" strategy by ILuvMarkets
charts.trendspider.com
“ATR Trailing Stop Bullish Breakout” strategy by ILuvMarkets

ATR Trailing Stop Bullish Breakout is a long strategy created by ILuvMarkets on TrendSpider.

Entry conditions (all of the following on the daily chart):

  1. The price closed higher than the ATR Trailing Stop (14, 3).

Exit conditions (all of the following on the daily chart):

  1. The price closed lower than the ATR Trailing Stop (14, 3).

TS: ATR Long

"TS: ATR Long" strategy by Kevin Shah
charts.trendspider.com
“TS: ATR Long” strategy by Kevin Shah

TS: ATR Long is a long strategy created by Kevin Shah on TrendSpider.

Entry conditions (all of the following on the daily chart):

  1. The Average True Range (14) is less than or equal to the Average True Range (14) one candle ago.
  2. The Average True Range (14) one candle ago is less than or equal to the Average True Range 14 two candles ago.

Exit conditions:

  1. Take profit if gained more than 20%.
  2. Trailing stop at 5%.

TS: Ichimoku Long Strat

"TS: Ichimoku Long Strat" strategy by Kevin Shah
charts.trendspider.com
“TS: Ichimoku Long Strat” strategy by Kevin Shah

TS: Ichimoku Long Strat is a long strategy created by Kevin Shah on TrendSpider.

Entry conditions (all of the following on the daily chart):

  1. The price closed greater than or equal to the Ichimoku Cloud Senkou A line.
  2. The price one candle ago closed less than or equal to the Ichimoku Cloud Senkou A line.
  3. The price closed greater than or equal to the Ichimoku Cloud Senkou B line.

Exit conditions (all of the following on the daily chart):

  1. The price closed less than the Ichimoku Cloud Senkou B line.

These examples only scratch the surface of the extensive strategy configurations available on TrendSpider. The platform offers a vast library of pre-built strategies ready for import and testing. Additionally, you have the freedom to customize and create your own strategies using the many options and parameters available.

The Bottom Line

In conclusion, backtesting trading strategies is a crucial step in validating and optimizing trading approaches. By configuring strategies, defining conditions, and analyzing key performance indicators, traders can gain valuable insights into strategy effectiveness. Testing across various timeframes, assets, and samples enhances robustness. Continual refinement and adaptation are key for successful trading. Embrace strategy testing with TrendSpider’s Strategy Tester to unlock your trading potential.

Related:

  • Strategy Development

    Trading Strategy Development 

    In the world of trading, achieving success requires informed decisions and effective strategies. Backtesting and a strategy-centric approach play pivotal roles in traders’ pursuit of profitability. This article explores the importance of backtesting, strategy configuration, key performance indicators, and the concept of strategy-centric trading. Traders will gain insights into enhancing their strategies and improving long-term …
    Trading Strategy Development
  • Strategy Development

    Backtesting Basics 

    Backtesting is a vital tool for traders and investors, enabling them to evaluate and refine their strategies by simulating their performance against historical market data. By analyzing the past, traders gain valuable insights into their strategies’ potential future performance. In this article, we provide an introduction to the basics of backtesting, outlining its benefits, how …
    Backtesting Basics
Backtesting Basics Backtesting Key Performance Indicators (KPIs)