When developing a new trading strategy you are usually confronted with multiple tasks: Design the entry, design the exit and design position sizing and overall risk control. This article is about how you can test the edge of your entry signal before thinking about your exit strategy. The results of these tests will guide you to the perfect exit for the tested entry signal (entry-exit combination)
Quality of an Entry Signal
When you develop a new idea for an entry signal there are two things you would like to see after the entry: no risk and fast profits. This would be the perfect entry with the highest possible edge. In reality the market response to your entry will be risk and chance. With a good entry the upside would outnumber the downside.
To quantify the edge of the entry signal I programmed me the “APPENDIX” indicators. My work is based on the ideas of Dave Bergstrom and his e-ratio indicator.
To quantify the edge of an entry signal you can either use a graphic approach, as I did in my article on the distribution of returns. Or you could test the statistical edge as I did in this article. Dave Bergstrom’s idea was to measure the average market response to an entry signal over several consecutive days after the entry and show the results in an easy to interpret indicator.
On the chart above you see the basic measures of how to quantify the edge of an entry, without having to have an exit strategy.
The APPENDIX_E indicator does a bar-by-bar analysis of what has happened after the entry signal. It uses the maximum favorable move and the maximum adverse move to do so.
For every bar after the entry these two numbers are calculated, and then the average ratio of the two numbers over all signals on the tested data is plotted for each day after the entry.
If the ratio of the favorable moves vs the adverse moves is greater than one, your entry has got some edge. On the chart shown above the ratio would only get above one after 17 data points. Before that, the adverse move would have been bigger than the favorable move.
If your entry signal response would be like that on average, your entry would not have any advantage for the first 17 data points, as the risk taken would be bigger than the possible profit gained.
APPENDIX_E and APPENDIX_P
To use the max favorable and adverse move after an entry to calculate this indicator is not the only way to do it. I prefer to use the Profit Factor as a measure for the edge of the entry signal. (Profit Factor = (sum of earnings) / (sum of losses)) Instead of using a bar-by-bar calculation of the max favorable and max adverse move as Dave’s e-ratio does, I calculate the gross profit and gross loss on a bar-by-bar basis and then use the ratio of gross profit vs. gross loss as the measure for the edge. All calculations are done in % to get rid of the absolute level of the market and make results more comparable.
The chart above shows the APPENDIX_P indicator for a short term entry signal. The blue line is the response to an entry signal, the magenta line shows the overall market behavior, as if there would have been an entry signal on every bar/day.
As the test has been carried out on a bullish market, both lines are rising with each day passing by. If you would have traded the market using a buy and hold and would have held your position for 50 bars, your strategy would have had a profit factor of around 1.7.
The blue line, the response to the short term entry signal, shows roughly the same behavior. Only for the first 4 to 5 bars after the signal you would have had some edge. Later on the entry signal losses its predictive properties and the results would be like the normal market behavior. The difference between the response to your entry signal vs. the general market behavior would quantify as the edge of your signal.
The chart above gives a comparison between the two calculation methods. Dave Bergstrom used a calculation similar to the APPENDIX_E indicator, using the ratio of the favorable and adverse excursion. I am more tending to use the APPENDIX-P, the profit factor based calculation. But as you can see both methods yield similar results.
On the chart above you would try to find an exit after 7 to 10 bars after the entry. This seems to be the area where you can expect the biggest profits and the best risk to (possible) reward ratio.
Testing a reversal detection indicator
The chart above shows a propitiatory reversal detection indicator. It draws a trend line as soon as an excessive move is detected and a reversal can be expected. As I like to sell a put option whenever a trend line is drawn, I would like to know how many days after the entry I should close my position.
This question is answered with the APPENDIX analysis above. As long as the APPENDIX_E (excursion ratio) is rising, the market is moving up on average. On day 9 after the maximum value seems to be reached. When APPENDIX_E is turning downwards, new lows start to show up, bringing the favorable/adverse excursion ratio down. So 9 days after entry would most probably be the best time to cover my short put.
The blue line underneath the APPENDIX_E signal response line (chart above) shows the general market behavior. While the maximum edge after the entry has been a 2:1 favorable / adverse ratio, the average market move over the same period of time would only have been around 1:1.15. So I would judge that this reversal detection indicator offers some edge in timing a bullish market reversal.
By comparing the APPENDIX_E to the APPENDIX_P, the excursion based calculation against the profit factor based calculation you could even go for a more precise timing of a possible exit strategy. If you would initialize a long position as soon as an entry signal is given, you should try to exit your position 1 to 7 days after the entry. Later on the averaged profit factor will get worse, and thus you would need a more intelligent exit to make use of the initial edge of the entry signal.
Differences to Dave Bergstrom’s e-ratio
My work is based on Dave Bergstrom’s ideas. But I gave his e-ratio indicator a slightly different algorithm, as I did not like the way he is calculating it.
The commons: APPENDIX_E and e-ratio are based on the same idea, to use the maximum favorable and adverse movement to describe the indicator edge.
The differences: e-ratio normalizes each MAE&MFE move by the average true range. Dave used ATR to get rid of different volatility levels across markets and make the results comparable. I do not follow this approach and use the % MAE&MFE moves. This allows me to get rid of the absolute market level, but it does not account for volatility. ATR is an indicator with all it’s downsides like parameter setting and lagging, this the intrinsic properties of this indicator will be reflected in the e-ratio indicator.
APPENDIX_P is based on the profit factor calculation. The % returns are used to calculate it. If you would like to account for different volatility in different markets, please use some kind of volatility based signal weighting. e.g. set the signal to 2 instead of 1 if you want to invest more in low volatility markets. I think that this approach offers more flexibility than Dave’s original work.
Using the APPENDIX indicator in Tradesignal Software Suite
To run the signal analysis as shown you just have to call the appendix function.
You can either call APPENDIX_E to get the excursion based calculation or APPENDIX_P to get the profit factor based analysis.
The function has got two inputs. The signal and the bars to analyse.
The appendix_E functions accepts -1, 0,+1 as signal. It can be used to test basic entry signals. (1=long,0=flat,-1=short)
The appendix_P function accepts any real number as signal. A signal of 1.5 would just constitute for a long signal with 50% more weight than a pure 1 signal. This way you can test complex signals, including the position sizing algorithm.
The indicator code above gives a simple example on how to do it. You could also call the function in an existing trading strategy, and just set the signal to 1 or -1 each time a trade is opened. Then compare the results of the APPENDIX analysis to the average holding period of your strategy. If, on average, your strategy stays in the market for a longer time than APPENDIX would suggest, you might want to work on a faster exit strategy.