Algorithmic Trading Tips 18.
HOW GOOD ARE YOUR SIGNALS?
EVALUATING THE QUALITY OF YOUR TRADING SIGNALS CORRECTLY.
In this issue you will learn how to evaluate the quality of your trading signals. A new indicator is presented, which provides a clear overview of past performance. It also provides a number of additional metrics to quantify the risk-return profile.
DOWNLOAD WORKSPACE. (For users with Refinitiv Eikon.)
DOWNLOAD WORKSPACE. (For users with Bloomberg.)
Every algorithmic trading strategy has basically two dimensions: Trading signals and money allocation. The first one regards the type of orders the system generates and the time those orders should be taken whereas the second one regards the amount of the trading instrument to trade.
Most of the times the testing and evaluation of a system is performed by examining those dimensions together. If you want to know your system inside out and understand the reason behind its profitability (or its failure) you must study the system’s dimensions not only in unison but also separately. This Trading Tips issue focuses on constructing and gauging the performance curve of a system‘s trading signals in-and-of themselves thus completely disregarding the system‘s money allocation dimension.
USUAL EQUITY CURVES MAKE NO DIFFERENCE BETWEEN SIGNAL AND MONEY MANAGEMENT.
There are two popular equity curves to evaluate the performance of a trading strategy. I call them CumulativeProfit and MultFracProfit. The CumulativeProfit assumes that you trade one unit (or a constant number of units) of the trading instrument for every signal whereas the MultFracProfit curve assumes that you reinvest the profits of each trade.
Regarding the CumulativeProfit, if you trade the same number of units of the trading instrument every time a signal is generated then you invest much more money when the price of the trading instrument is high than when its price is low.
- Example: If you buy 100 shares of a stock each time a buy signal emerges then if the price of the stock is $30 you invest $3,000 in the signal whereas if the price of the stock is $3 you invest $300 in that signal.
- Result: The CumulativeProfit fails to eliminate the money allocation dimension of the system.
Regarding the MultFracProfit curve, the involvement of money allocation is more obvious since you indirectly assume that you start with an initial capital and you reinvest the profits of previous trades.
- Result: In effect you will put much more money in signals that follow a stream of profitable trades and you put less money in signals that follow a stream of losing trades.
In short, the CumulativeProfit and MultFracProfit curves are incapable of isolating and gauging the performance of the system’s signals dimension from the system’s money management one.
THE SOLUTION: APPRAISING THE SIGNALS OF USING THE CUMULATIVEPROFIT% CURVE.
An effective way to evaluate the performance of a system’s signals themselves is by what I call the CumulativeProfit% curve. This curve is constructed by practically assuming that you always invest a notional 1$ in each and every trade proposed by the trading signals.
Suppose that you have a buy signal at price Pbuy and a later sell signal at price Psell. The profit you would have got assuming you followed the signal by investing $1 is (Psell − Pbuy)/Pbuy. If the sell signal was first, the profit would be (Psell − Pbuy)/Psell.
The CumulativeProfit% curve is constructed using the cumulative sum of such profits so the value of CumulativeProfit% after the completion of trade n (where n≥1) is:
6 RISK AND REWARDS GAUGES.
Moreover, in the statistics tab of the performance report you will find six gauges which describe the risk and reward profile of the signals as implied by the CumulativeProfit% curve. These are:
HISTORICAL EDGE OF THE SIGNALS (CPP_Edge)
This is simply the last value of CumulativeProfit% curve divided by the number of trades. It shows you the historical edge you are given by the signals. The higher the edge, the better the signals.
If the last value of CumulativeProfit% is say 5 and the number of trades is 100 then the edge of the signals is 0.05 (or 5%). This means that – on average – the signals gave you a 5% edge every time you followed them. Assuming you have used a long history of the trading instrument in various market conditions and the signals generated many trades this gives you an estimate of what you can expect to gain by following the signals. An edge of 0.05 (or 5%) means that if you always invest 100 000 Euro in the trades generated by the signals, you expect to get (on average) 5 000 Euro from each one of them.
MAXIMUM DRAWDOWN (CPP_MaxDD)
The Maximum Drawdown (or MaxDD for short) is the largest peak-to-trough distance in the CumulativeProfit% curve. The lower the MaxDD, the better the signals. Again, assuming that you have used a long history of the trading instrument and the signals generated many trades the MaxDD practically shows you the least you should expect to lose at some point following the signals.
If for example MaxDD is 5 then this means that if you planned to invest 100 000 Euro in the trades generated by the signals and you started following the signals at the worst possible time in the CumulativeProfit% curve then you should have 600 000 Euro ready because you would have to experience a loss of 500 000 Euro and you would also need an extra 100 000 to follow the next signal.
PROFIT TO MAXDD RATIO (CPP_ProfitToMaxDD)
This is simply the last value of CumulativeProfit% divided by the MaxDD. The higher this ratio, the better the signals.
LONGEST DRAWDOWN (CPP_MaxRecoveryBars)
This is the highest number of consecutive bars the underwater equity of CumulativeProfit% was below zero. The smaller this number, the better the signals.
A MODIFIED SHARPE RATIO (CPP_ModSharpe)
This is a modified version of the classic Sharpe Ratio so the higher it is, the better the signals. It requires a period parameter (namely: SharpeAndSortinoPeriod) which is a positive integer and can be changed via the Indicator properties. The default value for the SharpeAndSortinoPeriod is 21¹. The short formula for the modified Sharpe Ratio is:
¹ Depending on the chart you apply the CumulativeProfit% indicator you can change the SharpeAndSortinoPeriod parameter (that is, the k) to represent annual, monthly, weekly or whatever period you wish. For example, if you are interested in the annual Sharpe in a daily chart then you should set the parameter to 252 since a year has approximately 252 trading days. If the chart is weekly then you should set this parameter to 52 (a year has approximately 52 weeks).
A MODIFIED SORTINO TYPE RATIO (CPP_ModSortino)
This is a modified version of the Sortino Ratio so the higher it is, the better the signals. Like the modified Sharpe Ratio it depends on the SharpeAndSortinoPeriod parameter. Both the modified Sortino and the modified Sharpe ratios are reward/risk metrics. Their difference is that the modified Sharpe regards risk as both upward and downward volatility of performance whereas Sortino regards risk as only downward volatility of performance (see our Algorithmic Trading Tips 16).
PRACTICAL EXAMPLE: DEFAULT EQUITY CURVE VERSUS CUMULATIVEPROFIT% CURVE.
Now we come to a practical example. Figure 1 shows (next page) the Akamai share on a daily chart with the trading strategy “Bollinger Band Entry” applied. In addition to the conventional equity curve (middle) the CumulativeProfit% curve is displayed (bottom). The SharpeAndSortinoPeriod parameter is 21 and the ShowIndividualStatsInPortfolio parameter is set to ‘False’.
When the price of the trading instrument has gone from very low levels to very high ones (or vise-versa) the differences in the Tradesignal‘s default equity curve and the CumulativeProfit% curve are noticeable:
- The price of Akamai Technologies was close to $300 near the beginning of 2000 and ended up close to $0.5 during the fall of 2002.
- The default equity curve (middle sub chart) calculates profits assuming buying/selling the same number of shares all the time. Due to the low absolute price level there is very little change despite the strong upmove during 2003 The equity curve downgrades the performance of the signals after 2002.
- The CumulativeProfit% on the other hand clearly depicts that the signals of the strategy had a superb performance in 2003. The equity curve now reflects the real quality of the trading signals.
The default equity curve shows the combined performance of the trading strategy, while the CumulativeProfit% curve reflects the performance of the trading signals themselves.
FIGURE 1: DEFAULT EQUITY CURVE (ORANGE) VS. CUMULATIVEPROFIT% EQUITY CURVE (BLUE).
In this example the “Bollinger Band Entry” strategy was applied in Akamai shares. Due to the low price levels after the crash in the years 2000 to 2002 the default equity curve (middle subchart) – despite the sharp increase in 2003 – shows little change. The CumulativeProfit% equity curve (lower subchart) delivers a realistic picture of signal quality.
RISK RETURN GAUGES APPLIED TO A PORTFOLIO.
Besides the SharpeAndSortinoPeriod and the ShowEquityUnderWater parameters, the CumulativeProfit% indicator has one more input parameter which is of True/False type (namely: ShowIndividualStatsInPortfolio). It enables you to activate or deactivate the display of all key figures, which are reflected in the performance report. They each start with the abbreviation “CPP_”.
FIGURE 2: CUMULATIVEPROFIT% IN PERFORMANCE REPORT.
All metrics of the CumulativeProfit% Indicator are displayed in the performance report.
If you want calculate the values of the six key figures and compare them for several securities, please proceed as follows:
- Create a portfolio with several securities
- Apply a trading strategy of your choice
- Insert the CumulativeProfit% indicator
- Set the input ShowIndividualStatsInPortfolio to “Yes”
All key figures are then displayed in separate columns in the portfolio table for every symbol (see Figure 3). This will give you a quick and convenient overview of the risk return spectrum of the chosen trading strategy on individual stocks.
FIGURE 3: CUMULATIVEPROFIT% INDICATOR WITH ALL GAUGES (EQUITY PORTFOLIO).
In this example the CumulativeProfit% indicator and all other gauges are calculated on the basis of the strategy “Bollinger Band Entry” for 10 shares from the Nasdaq Composite. For this purpose, the input ShowIndividualStatsInPortfolio needs to be set to “Yes” in the properties window.