Understanding Strategy Tester from TrendSpider

TrendSpider offers a powerful backtesting engine called the Strategy Tester. It is designed to make it easy to create, test, refine, and explore how any of your trading strategies would perform based on the entry and exit conditions defined by you, using an intuitive visual interface.

With Strategy Tester, you can backtest your trading strategies with 50+ years of historical market data, depending on the symbol you have selected and how much history is available for it. In most cases, it can backtest all the way from the inception of the symbol’s trading (subject to the data feed limitations).  You can run your backtest on stocks, futures, crypto, forex, and OTC's.  You can not backtest indices or options data.

In this way, you can avoid the strategies that would have underperformed and focus on high-probability opportunities only. In this documentation, we will explore

Let’s get started 🚀

Strategy Tester

A Strategy Tester (or Backtester) is a tool that you can use to see how a strategy you have defined has behaved on the past data. One of the best things about the TrendSpider Strategy Tester is you can conduct complex backtesting experiments without having to write any code. Any trader who can describe a strategy in words to a friend can use our Strategy Tester just as easily.

The Limitations of Backtesting

First and foremost, you should understand that no back tester ever can tell you that your strategy is awesome and you should use it right away. The only thing a strategy tester can do (and it's quite good at that!) is tell you if your strategy sucks badly. Realizing that changes the game.

You should not focus on building a strategy that beats buy and hold in a backtest. You should rather focus on building a strategy that can not be disproven (aka "illustrated to suck badly") by a back tester.

Backtesting looks at the past. It tests how a strategy would have performed if traded perfectly in the past. Remember, past performance doesn't guarantee future results, so don't assume it will.

In backtesting, it's assumed that you can execute trades flawlessly and without delay like a robot would. However, as a human trader, it's important to recognize that you may not be able to execute trades at the exact same prices as the strategy tester unless you automate your trading process. Keep in mind the limitations of human speed and consider automation for more precise trade execution.

Here are some limitations that are specific to TrendSpider.

#1 Backtesting assumes $0 broker fees. While most brokers offer $0 trading fees now for most asset classes, not all of them do. There is no accounting for any trade-related costs of any kind. In real life, you will likely have at least some costs, commissions, etc. that may eat into your returns.

#2 Backtesting assumes perfect execution and zero slippage. In other words, it assumes you have perfect liquidity, and your orders fill at a specific, predefined price every time (either the open, close, low, high or some average of these). You can use "Trade by next" to help make more realistic assumptions to reduce the impact of potential slippage on your strategies once you bring them to the market.

#3 Our back tester assumes that you always can afford an entry, never mind what kind of losses you have had. This might introduce some unrealistic outcomes into strategies with significant drawdown.

The Advantages of Backtesting

Despite the fact that past performance can't guarantee results in the future, you want to backtest your strategies. Backtesting is going to give you some very valuable information. You need to step away from obvious things like "Was it profitable or not" and go a step deeper. You can see how the strategy behaved, so you can see the important meta-information about its character or personality, so to speak. For example,

  1. Was the strategy producing lots of trades or rather few of them? You need to know that to consider brokerage fees etc.
  2. Were your trades delivering a consistent outcome or some of them were negligible and some were spiky? You need to know that to evaluate the risk of investing real money.
  3. What was the worst draw-down for your trades? You need to know that to evaluate the risks and to decide if you need more stop-losses etc.
  4. What were the common drawbacks of a strategy? Did it exit on time or later, did it enter in a timely manner, did it produce early exits?
  5. Is your Win Rate anywhere close to what you need with an R/R ratio like that?

You can figure out the overall temper of a given strategy, which gives you a better vision of what you can expect from it all. Like, if after backtesting your strategy you see that it did 10 trades for the last year, then don't expect it to generally do 3 deals a day in the future.

If 99% of trades in the past were limited to ±1%, then you can fairly assume that doing 30% per trade is going to be an extremely rare (maybe even "barely real") case for this strategy.

If it did a late entry in 100 trades of 120, then don't expect it to catch the moves perfectly (or even "good enough") in the future.

Backtesting is especially good at signaling when your strategy is a definite no-go. It can't ever tell you "You must take this strategy for a ride now", but it can easily tell "Never use this strategy, nothing to see here, pass by". Interpreting the results of backtesting is all about figuring out the nature of a given strategy on a given market, and learning more about chances.

#1 You can determine how your strategy would have behaved in a given market with given parameters. By understanding this behavior, it’s easier to find an appropriate market for an existing strategy or to experiment with new strategies.

#2 You can optimize your strategy through backtesting. With this exploratory process, you can experiment with entry conditions and exit conditions. Our Strategy explorer offers a powerful way to learn about price behavior for your positions without having to make real investments.

#3 You can use the strategy tester to evaluate and backtest the performance of a strategy or idea before trading it on a real account with real funds. TrendSpider’s strategy tester consumes only a few seconds to complete the full backtest on any timeframe with any depth, which makes it easy for traders to test hundreds of ideas/models without risking real capital in the markets to test them.

#4 You can use the strategy tester to validate the effectiveness of a trading strategy fetched from online research from a recommendation by fellow traders or from a social media post/forum so you do not risk your money trading someone else’s ideas uninformed.

#5 Strategy Tester allows you to make the calculative decision by developing an understanding of the market, rather than acting out of emotions or instincts. Backtesting trading ideas or strategies before executing them reduces your emotional investment in the process and increases the probability of a successful trade.

For more information on how Strategy Tester can be beneficial to help you become a better trader without incurring any risks, please refer to our product page on Backtesting.

Create a New Strategy

You can use the Strategy Tester to create long or short strategies while defining your own custom entry and exit conditions. Alternatively, you can also use the built-in scripts from TrendSpider or your saved scripts.

Step 1: Click on the Strategy Tester button from the top-right corner of the top menu bar.


The Strategy Tester will appear below the primary price chart. You can also use the Maximize toggle on the far right to make the Strategy Tester larger.

Step 2: Name the Strategy or keep the default auto-generated name.

Step 3: Select the Type of Chart that you’d like to scan, including Generic OHLC, Heiken Ashi, Line, or Raindrop charts.

Step 4: Select the time frame to scan from the dropdown list.

Note: Unlike the scanner, alerts, and smartwatch lists that support multiple time frames, the strategy tester supports only a single time frame.*


Step 5: Check the Ext. Hours to allow the system to incorporate the data from extended sessions while running the strategy tester.

Please refer to the documentation on Extended Hours Support for more information.


Step 6: Select the Data Depth from the dropdown list. This option allows you to define how much data from the past, the strategy tester should accumulate and scan.

In the Strategy Tester, click on the 'Data' drop-down menu (default set to '300 Candles'). Two options are available:

Number of Candles

Use the slider bar to specify the exact number of candles you want the strategy tester to read. For example, if the current time frame selected on the chart is Daily, then defining the 7000 candles will instruct the tester to accumulate and scan the data from the past 7000 days.

This option is Ideal for testing a strategy over a specific number of candles, up to 7,000, in any time frame.


Date Range

Specify the exact dates for which you want the strategy tester to collect and read the data. Perfect for testing a strategy within a specific time frame, such as from the 2009 crash lows to the pre-pandemic high.


NOTES: Traders can choose only one option at a time between the "Number of Candles" and "Date Range" when adjusting the data depth in the Strategy Tester.

Let’s take an example, where the current time frame selected on the chart is Daily. In this case, selecting 7000 candles as Data Depth from the dropdown will instruct the tester to accumulate and scan the data from the past 7000 days.

It is to be noted that 7000 candles are the maximum depth, which means that on different assets, the maximum amount of time that can be tested will vary based on the timeframe you have selected on the chart. For example, 7000 candles selected on a 1-minute chart will scan the data for 7000 minutes.

For US equities, a trading session is 390 minutes long, and there are 5 trading days per week which means that in one week, there are 1950 minutes of trading that occur. This means on the 1-minute chart, running a backtest for 7000 candles will include 5.12~ days of data (7000 Candles/1950 minutes).

However, on the Daily timeframe, this will be treated differently. There are 253 trading days in a year which means a backtest on the daily timeframe can look back 39.5 years depending on how much data the symbol has.

Step 7: Define the value for The Trade by Next. This option allows you to select the most realistic entry criteria for your trades. For example, the Close setting means that trades are placed after the next candle's close rather than its open.

Note: Irrespective of your selection here, the Strategy Tester will always consider the *NEXT* candle of the selected value.

Note: By default, the *Open** is selected because our design goals assume that humans are not as fast as computers to respond. Trading at the same time a trigger condition is met would be something very difficult for an individual trader to match because multiple factors are involved like slippage, etc. Hence, by trading on the following Open candles, we try to make it a bit realistic. If traders want to account for more slippage, then they could switch to an average of the next Open and Close or High and Low as well.*


Step 8: Select if your strategy is Long or Short.


Step 9: Define the technical conditions for the Entry and exit positions of your strategy.

#1 Entry Position: Define your custom technical conditions for the entry position i.e. when to buy using the same visual editor as the Multi-Factor Alerts.

Note: By default, a system-generated name is assigned to your script(s) defined in the Entry & Exit conditions. In the example below, you can observe the default name for the script in the Entry condition labeled as "Papa" and the default name for the script in the Exit condition labeled as "Yankee".

You can rename these system-generated names assigned to your scripts and if there are multiple scripts defined in your technical conditions, then you will be able to track which script triggered the entry and exit conditions through these custom names visualized on the chart.


Click on the “add parameter here” and select any of the following from the dropdown list:

  • Condition: Select this option to add a parameter(s) within a group.
  • Condition Group: Select this option to add a parameter(s) to a group nested under an existing group.
  • Load From Template: Select this option to load a pre-made script template.

Since Strategy Tester uses the same builder tool as Multi-Factor Alert, you can refer to the documentation on How to Create Multi-Factor Alerts to learn more about- pre-made script templates, saving a template, removing a template, commenting on the block, and more.

Note: You can add multiple scripts while defining the entry position.

#2 Exit Position: Define the criteria for the exit position i.e. when to sell by using any of the following or the combination of the following conditions:

A. SCRIPT: Add the technical conditions for the exit position using the same visual editor as the Multi-Factor Alerts.


B. ENTRY INVALIDATED: Using this condition means entering a position “any time when the entry conditions become true” and exiting when the entry conditions are not true anymore. A thing like that can be useful if your entry criteria do not include the "trigger condition" (which only stays true for a candle or two) and only include "filter conditions" (which can last).


C. # CANDLES PASSED: Exits the position after a given period of time, for example. “30 candles”. This condition can also take your current PnL into account. I.e., if your Price Behavior Explorer shows you that if a position has not gained +1% after 10 candles then it will never be a winner, then you might add Exit after 10 candles if PnL < 1% in order to capture at least some profits from the positions which will convert into losers otherwise. Be aware that using that means curve-fitting your strategy. It's not necessarily a bad thing to do, but you have to understand the implications.


D. TAKE PROFIT: Exits when your position gains more than X%. The logic uses a "Limit Order" to provide a realistic price. The "after candle close" checkbox uses "market price after candle close" to emulate filling your stop loss order. This is not how real stop market orders work, but it's a safe way to go if you're going to automate your strategy and run it as a Trading Bot.


E. STOP-LOSS: Exits when your position loses more than X%. The logic uses a "Stop Market" order to provide a realistic price. Mind the "after candle close" checkbox, just like for a stop loss.


F. TRAILING STOP: Uses a classic percentage-based trailing stop; exits when your position loses X% from its highest high. Mind the "after candle close" checkbox, just like for a stop loss or take profit.


Note: Take Profit, Stop Loss, and Trailing Stop have an option of “executing upon candle close only” which is different from how they work in the real world. However, this option makes them match “how Trading Bots behave” on TrendSpider. So in case if you are testing a strategy for the purpose of running a Trading Bot with it, please make sure to have this “On candle close” option active.

Using the combination of any condition from A to F explained above allows you to create a sophisticated exit condition. For example, you may exit the position when the SMA 20 crosses down through SMA 50 and implement a 2% stop-loss.

Note: The traders can have as many Scripts for entry and exit conditions as they want.

Step 10: When you're ready to run the test, simply click the Run button and visualize the results of your strategy on the chart.


Note: TrendSpider provides advanced backtesting conditions for traders looking for greater control, including offsets and time-based conditions. Offsets are required for some situations like when testing Ichimoku Cloud strategies. In these cases, the TrendSpider will warn the users.

For more information, please refer to the documentation on Offsets and time-based Conditions

Also, every time you flip through the charts from the Watch list, the back tester will run again.

Visualize the Results

TrendSpider makes it easy to visualize how a strategy performs on a given chart by automatically painting entry and exit arrows onto the chart as long as you have your Strategy Explorer widget open.

For more information on visualizing the result, please refer to the documentation on Visualize the Result.

Understanding Charts in Strategy Tester

Once you create a strategy, TrendSpider allows you to run your backtest strategy and view its direction and performance through charts.

For more information on exploring charts to view the performance of your strategy, please refer to the Understanding Charts in Strategy Tester documentation.

Save & Clone Strategies

A saved strategy in TrendSpider is a comprehensive collection of buy and sell rules conveniently stored in one location for easy recall. Additionally, TrendSpider offers the functionality to clone existing strategies, allowing users to create duplicate copies easily.

For more information on saving and clone strategies refer to the documentation on Saving, Cloning, and Recalling Strategies in the Strategy Tester.

Remove & Share Strategies

TrendSpider allows traders to remove & share their Strategies developed on the TrendSpider platform with others.

Share Strategy

TrendSpider allows traders to share their Strategy developed on the TrendSpider platform with others.

Step 1: Click on the vertical ellipsis (⋮) adjoining the Save button.


Step 2: Select the Share this Strategy option from the list.


A modal window will appear providing you with the option to select who can access your Custom Watch List while sharing. You can select any of the following two from the dropdown: Everyone with a link can access or Only specific people can access and click on the Share button to generate the link.


Similar to Google Docs, there are two ways to share strategy:

#1 Everyone with a link can access: You can generate a special link that anyone can use to subscribe and receive access to your strategy.


If they open the link, they will see a special page that describes what’s behind the link. If they click “Import this List”, “Login & Import”, or “Signup & Import”, they will be redirected to a TrendSpider application and confirmation request.


#2 Only specific people can access: You can invite specific people via email by selecting the option- Certain People from the dropdown list, entering their email addresses (should be separated by commas) in the provided field, and clicking on the Share button.


If they are TrendSpider customers, they will receive an email invitation and an in-app notification prompting them to access the materials. If they are not a TrendSpider customer, they will receive an email invitation containing your affiliate link, if applicable.


Note #1: You can also switch the “existing access criteria”, by changing your selection from the dropdown and clicking on the Update button.


Note #2: If the content owner revokes the public access to your Strategy, whether shared with everyone or specific people, then users subscribed to such a Strategy will lose their access immediately.


Remove Strategy

You can remove the Strategy you don’t need by following the two simple steps outlined below.

Step 1: Click on the vertical ellipsis (⋮) adjoining the Save button.


Step 2: Select the Remove this Strategy option from the list.


As a result, the Strategy will be removed from the Watch List.

It is to be noted that you cannot share the built-in Strategies provided by TrendSpider and the option is, therefore disabled. You can only clone them, remove them, and create your own version.


Download Backtest Data to CSV or TSV

You can easily download the results of any backtest in the CSV or TSV format, providing a convenient way to analyze and further explore the outcomes of their strategies

Note: You can also reset your backtest results by selecting the Reset Backtest Results from the list populated under the Trades button.

For information refer to the documentation on Downloading Backtest Data to CSV or Excel

Create Multi-Factor Alert

On the top of each technical condition set, you will find the option to create the Multi-Factor Alert by clicking on Alert me Next Time This Happens.


As a result of this action, you will be able to create Multi-Factor Alerts on your conditions. For more information, please refer to the documentation on Multi-Factor Alerts.


Mar 12, 2024

Contact Us

Not finding what you're looking for? Contact Us Directly