Once you create a strategy, TrendSpider allows you to run your backtest strategy and view its direction and performance through charts.
In this documentation, we will explore:
- Price Behaviors Explorer Chart
- Performance Chart
- Tabular Data
Let’s get started 🚀
After backtesting your strategy, you will be able to view the Price Behavior Explorer chart, which allows you to vizualize the behavior of your strategy over a certain amount of time while in a position.
It helps answer many questions, like:
- Am I timing my trades correctly?
- Am I leaving too much profit on the table?
- Am I cutting my losses quick enough?
- How many of my trades were short living, and how many of them lasted longer?
You can use this chart to discover if you were buying and selling at the right time, as well as to discover ways to improve your exit conditions.
Here’s how we build it:
Each position you had has a “track”, which is essentially a piece of price action for the time period while you were in that trade.
Imagine that you had one position. For the first candle after your Entry, the price has changed by +1% (vs. the Entry price). For the second candle, the market kept rising and you made +2%. For the third candle, the price slightly retraced and you were at +1%. For the fourth candle, the market went up +3% and you exited (say, you’ve met your exit criteria of SMA crossing e.t.c.).
You can paint the track of this position like that:
Usually, your strategy has more than one trade after you backtest it. All the trades can have different lengths and price behavior, and here’s how the chart above would look if we added tracks of all your positions:
Pretty messy — and that’s a fairly small number of positions painted! Luckily, there’s a way to simplify the look while skill preserving most of the information. We could paint an “Average Track” line, and accompany it with two lines, such as the “25th percentile” and “75th percentile”. We could also add “Maximum” and “Minimum” lines. Here’s how it will look then:
This chart is looking rather busy, but it’s incredibly useful when you master it. In a single chart, you can instantly understand if your strategy identifies the market conditions you wanted it to identify. For example, if you’re building a trend-following long strategy, then you would want your Mean line being above zero all the time.
Let us walk through the elements of a Price behavior explorer of TrendSpider:
Mean Change% (Blue Line)
Toggle on the Mean Change % from the chart legend. The mean change% line on the chart reflects the mean (average) percentage change in returns after certain candles. You can co-relate this mean change% with the Y-axis (right) which reflects the percentage return scale and the X-axis at the bottom which reflects the number of candles from entry.
Median Change% (Purple Line)
Toggle on the Median Change % from the chart legend. The median change% line on the chart reflects the median percentage change in returns after certain candles. You can co-relate this median change% with the Y-axis (right) which reflects the percentage return scale and the X-axis at the bottom which reflects the number of candles from entry.
Random Control (Mean)
Sometimes the market just goes up regardless of the strategy — it’s difficult to know if your strategy is responsible or if it’s the underlying market. The same is true for extensively declining markets and short trades. When you test your strategy, you want to know what’s the root cause for your outcome: was it the strategy doing good, or simply the market going up or down?
That’s where the Random Control line comes into play. Here’s how we build it.
Imagine that you’ve backtested your strategy and your strategy generated 50 trades — the longest of them being 40 candles long. In this case, Strategy Explorer picks 50 random points on the same price chart where you tested your strategy, and collects 40-candles-long tracks starting at each of them. After that, it calculates the Average Price Behavior line (exactly the same math as behind the green “avg” line on the chart above) and paints it on your Price Behavior chart.
The usage is pretty straightforward: If you’re building a long-trading strategy and your Average Price Behavior line is above the Random Control line, then this means that your strategy has picked the time frames when market was rising better/faster than it did in general (for a given depth of backtesting). The Random Control line works the best when you’ve got a decent number of trades and when all of them are having approximately the same length (this means there’s no difference by a power of 10).
# Of Positions
Toggle on the # of winning positions from the chart legend. This will plot the green line on the chart reflecting the number of positions that have been completed after certain number of candles from entry. Toggling this on will plot the number of positions on the Y-axis (left). Rememeber that these are positions which ended up being winners. Some of them could have been losers at some point in their history, but they will only count as winners because of the final outcome.
96% of Winners/Losers
Toggle on the 96% winners or 96% of losers from the chart legend. This cloud illustrates how did the price behave during trades which ended up being winners. The 2nd percentile to 98th percentile range is used to weed out extreme outliers. If you still want these outliers, then consider using Min/Max clouds.
Toggle on the Min/Max Change% for winners from the chart legend at the bottom. This will show a green cloud on your chart.
Toggle on the Min/Max Change% for losers from the chart legend at the bottom. This will show a red cloud on your chart.
The minimum and maximum mean percentage changes are shaded on the chart to show the absolute highs and lows over certain candles.
96% Pre-entry clouds
Toggle on 96% of winners pre entry or 96% of losers pre entry. This enable's percentile clouds which illustrate price action prior to your entries. It gives you a sense of how the price action looked like before you enter. This is the ultimate tool for determining whether you enter trades too early or too late.
After running your backtest strategy, you will also be able to view the Performance Chart that reflects the relevant performance of your strategy vs. buy and hold.
It combines a bird-eye view of a whole lot of history used for your backtesting using gray and blue lines.
Asset (Gray Line)
Toggle on the Asset the chart legend at the bottom. This is the stock price line (gray) which shows the performance of the buy and hold. In the example below, if you would have bought this stock and would have never sold it, then you would have lost -32.08%. However, through your trading strategy, you would have lost only -25.73%, hence you outperformed the buy and hold strategy in this case (you’ve made some decent losses still, yes).
Portfolio Value Line (Blue Line)
The blue line shows how much you would have made using the strategy over on a comprehensive basis. In this particular base, the +80% return is significantly underperforming the buy-and-hold return of +1,700% over the same period of time (e.g. 7,000 candles).
Toggle on the Positions from the chart legend at the bottom. This makes some parts of the Asset Performance line green and some parts red. The green area on the line indicates that you entered the trade and you were profitable. The red area on the line indicates that you entered the trade but lost your funds.
Using the Positions lines, you can easily see if you were riding the trend.
Position Contribution Chart
The position contribution chart, also known as Winners Vs. Losers or Gainers Vs. Losers. The Gainers vs. Losers chart is rather straightforward — the only unusual thing here is this set of short vertical lines.
Each strip (red and green) has a number of short vertical lines painted on it. These lines indicate the impact of a single position — the further the line stands from a previous one, the higher was the impact of this trade. In other words, if you had only three losing trades, for -1%, -1% and -3% respectively, then you would have a picture like this:
The chart gives you a sense of consistency of your positions’ outcomes.
Now back about our particular backtest, here’s how the chart looks for me:
Here’s what you can see here:
- 66.7% (46, specifically) of your trades lost your money, 33.3% (23) were profitable.
- Each losing position has lost approximately the same amount of your money.
- Most of the profitable positions had negligible impact and there was a small number of positions (6) which gave a huge outcome, compared to others.
The interpretation of this chart could be: Your strategy was consistent at losing money, and was spiky when it comes to making money.
Position Return Distribution Chart
The Distribution of Gains and Losses is a powerful chart. The horizontal axis is “change (%)”, and each circle represents the outcome of one position. All the losing positions are painted red, all the winners are green.
Here’s what you can see here:
- The strategy was pretty consistent when losing money and the vast majority of losing trades ended up losing approximately 2.8%.
- Gains were very inconsistent. Average gain was +8.8%, and there are a few outliers standing for +20% or more.
- Average return of a trade was +1.1%. This is a positive number, which is nice.
From this chart, you can tell that the strategy has failed to deliver consistent positive results. The fact that losses were consistent definitely has something to do with our Stop Loss level, so one might want to try tweaking it. For example, you might move Stop Loss level to a wild -50% , then you get a picture more along these lines:
You can see that your average return is still modest, but your losses increased. So, having a sane stop loss level seems to be a good idea for this strategy (who could possibly imagine!!).
Toggle on the Drawdown from the chart legend at the bottom. This shows how lows (how much you have given back) in comparison to your highs. With this, you can navigate your worst point (drawdown) in your strategy. In the example below, the worst point is at -25.73%.
Drawdown can be a result of losing trades. It also can be a result of you staying in a position while price is taking a dive (even though you could be lucky and exit later with a positive outcome). Drawdown is a good measure of a pain you'll experience when trading: high drawdown is guaranteed to be painful to watch, lower drawdown can be not as bad.
We do display some high-level metrics of your strategy in a table view. Like, Win Rate, Reward-to-Risk ratio e.t.c. These numbers are useful if you want to see a rough summary (i.e., R/R + Win Rate + Expectancy) without diving into the details. It’s also useful if you want to compare a few strategies (you can copy the tabular data, paste it into a spreadsheet and compare).
The meaning for each of the metrics in the Tabular Data has been explained in the table below:
|Market||Represents the symbol on which the backtesting has been performed|
|Net Profit||Represents the Net Profit Margin Ratio for the entire strategy during its entire duration|
|Data Analyzed||Represents the time for which the data has been analyzed in the backtesting|
|Asset Performance||Represent what would have happened if you bought and held the asset the entire time|
|Beta Vs. Asset||Represent how close the value of the buy/sell strategy is relative to the price (e.g. does it move with the price or not).|
|Positions||Represent the number of positions/trades analyzed during the backtesting|
|Wins||Represent the percentage and number of winning trades out of the total trades analyzed|
|Losses||Represent the percentage and number of lost trades out of the total trades analyzed.|
|Max Drawdown||Represents the biggest pullback during the strategy in terms of the percentage. For example, when you gave back the most gains. The smaller this percentage, the better it is.|
|Average Win||Represents the average of a winning trade.|
|Average Loss||Represents the average of a losing trade.|
|Average Return||Represents the average of a series of returns generated over time as analyzed in the backtesting.|
|Rew/Risk Ratio||Represents the Reward vs Risk ratio which measures the profit potential of a trade relative to its potential loss.|
|Expectancy||Represents the average amount you can expect to win or lose per trade with your strategy when a large number of trades are taken (at least 30 to be statistically significant).|
Our Tabular Data view has a feature of highlighting metrics which are an obvious no go. I.e., if your Expectancy metric is negative, then it means that this strategy is losing money. A number highlighted also has a hint, so you can point your mouse to it in order to learn more.
Most of the principles behind these “no go” labels are straightforward, but one of them demands an explanation: relation between your Reward/Risk ratio and your Win Rate (% of winning positions).
Any time you run yet another backtest, we highlight changes in your metrics. We track all the metrics except of
Data analyzed and
Asset Performance. You will see comparison against "previous value of the corresponding metric" labels, next to the value of a corresponding metric. This comparison is straightforward, so even if you choose and backtest a different strategy, you will see the comparison — even though it might make not much sense, provided that the strategies are different. The idea is to compare "current results of a backtest" vs "previous results of a backtest", never mind what exactly you have backtested.
Each comparison label has a tooltip (if you point your mouse to it) explaining its meaning. Comparison labels have 3 attributes:
- direction of a change
- value of a change
1. Color of a comparison label
Color of a comparison label tells you whether the metric has improved (became better from standpoint of trading) or degraded. The label is green for improvement and red for degradation.
2. Direction of a change
In case if numeric value of a metric goes down, you will see a
▾ mark for it. In case if numeric value goes up, you will see
▴. For the metrics which are negative by their nature (drawdown and average loss), marks will be inversed.
3. Value of a change
The number per se is a discrepancy between current value of a metric and its previous value. Value is always expressed in absolute units, the same units the metric uses.
Examples of how to read metric change
- Max.Drawdown: Current value
-5.72, comparison label
red, ▴2.52. That means that your max drawdown has got worse, its absolute value went up by 2.52 and now it's -5.72. One can see that it also means that the drawdown was
-3.20before this backtest.
- Win%: Current value
72, comparison label
green, ▴12. That means that your Win% has improved, it went up by 12 and now it's 72. One can see that it also means that the Win% was
72 - 12 = 60before this backtest.
You can intuitively guess that in case if your Reward/Risk is 3 (i.e., any time you win, you get 3%, any time you lose, you lose 1%) then winning 1 time buys you a few potential losses: you can win once, and then making a few (remember about compounding percentage!) losses in a row will still keep your portfolio being “not less than in the beginning”. If you make “yet another loss”, then you’ll start losing money. You can tell that there is some kind of a “minimal Win% for the purpose of not losing money” for your R/R ratio.
We have figured that you can easily compute these “minimal Win%” values. We have built a simulation and then approximated the result with a regression model. Here’s a chart.
From this chart, you can tell that with R/R of 4.0, your minimal Win Ratio is ~25%. With an R/R ratio of 1.5, you need to have a win in 50% cases, and so forth. This model is not strict (we might be off by a few percent) but you can use it as a rule of a thumb when estimating the quality of your strategy. In case if your Win% is too low for a given R/R ratio, TrendSpider will tell you so, by highlighting your Win% and making a comment on it.