The Edge of an Entry Signal

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.


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.

appendix_P – profit factor

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.



Comparison of APPENDIX_P and APPENDIX_E

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

Kahlers Reversal Detector

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.

Appendix_E Reversal detector

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.

To download the Equilla and Easy Language code please refer to the code page. Everything is free to use for non commercial purposes. Please acknowledge this by typing “okforme” as password.

Thanks to Tradesignal for the great software to accomplish this task, thanks to Refinitiv for the great data.




9 thoughts on “The Edge of an Entry Signal

  1. hi , I’m interested in the “Kahlers Reversal Detector” you mentioned in your article , but can’t find any resource about it, would you kindly tell me where to learn it? Thanks a lot.

  2. Hi, great article, but I have trouble to access the code.

    For some reason it just shows:
    “noticed” phrase after I put the password.

    Is it possible to send it to my email?
    I will be very grateful
    Thanks a lot!

  3. Hi, thank you for code. Unfortunately i don’t know enough about programming (array) to use this function in Tradestation. Is it possible to get version of the code that will work in the Tradestation?

    I will be very grateful
    Thanks a lot!

    • Hi,

      unfortunately this code will only run with the Tradesignal software. Arrays should be no problem, but the portfolio testing (looping through symbol lists) will not work in Tradestation.
      Have a look at the Tradesignal homepage, they got a versions for institutional and private traders. Code will run with both versions.


  4. Interesting read! I was just wondering how you handle totally monotonic cases, where the symbol straight up falls (for short) or rises (for long) after entry, MAE for such cases would be 0, doesnt that make the edge ratio value to become undefined?

    • good point.
      if there is no risk then you got problems with the formula.
      But in general it’s always wise to exclude outliers when searching for an optimum. You do not go for the best value, but search for a stable area..

Leave a Reply

Your email address will not be published. Required fields are marked *