Improving the TD Sequential Long Strategy

ed854585ed854585 Posts: 22
edited July 2017 in Technical Analysis

I. Introduction

TD Sequential is a technical indicator for stock trading developed by Thomas R. DeMark in the 1990s. It uses bar plot of stocks to generate trading signals. The recognition of a buy signal involves three steps. Step one is the identification of a bear flip, where a bar whose close is higher than that of four bars earlier appears, followed by a bar whose close is lower than the close four bars prior. Step two involves counting 9 consecutive bars, each close lower than the close four bars prior. The third step, called countdown stage, is optional, which requires the trader to count 13 close prices lower than the low price two minutes earlier before entering a long position.

Several elements could be modified in this strategy. Whether to include the countdown stage, the choice of the number of bars in the setup stage and countdown stage, the parameters that help to decide when to exit and the size of the trade will affect strategy performance. In addition, we could use information other than price to decide whether the signal should be traded.

Part II is a comparison of the strategy performance by adjusting the aforementioned elements. Part III discusses the effect of adding Bloomberg’s social sentiment data to support trade decisions. For simplicity and control of variable purposes, all tests used AAPL one-minute bar data, and the time range of backtests was the first half of the year 2016.

II. The effect of modifying strategy parameters

1. Base strategy

The base strategy does not execute the countdown stage, which means a long position will be traded as soon as the setup stage is complete. Constant values are set for stop limit and stop loss (15 cents above and 30 cents below the entry price). Positions will be closed out before market close regardless of price levels. Trade size is set to be constant at 100.

Below is a brief summary of the performance of the base strategy in the first six months of the year 2016. All calculations include commission fees.

Fig. 1. PnL of Base Strategy

Fig. 2. Return Distribution of Base Strategy

The plots above show that for the given parameters, the daily returns of the base strategy were pretty volatile and negatively skewed. PnL plummeted in the first week, and then oscillated at the level of -400. The Sharpe ratio of the base strategy was negative, and the trade win percentage was a little more than a half.

Table 1. Core Statistics of Base Strategy

2. Changing exit rules

Choice of stop profit and stop loss levels would determine when to exit a position, affecting the duration and number of trades and strategy PnL.

The following backtest used the same parameters as the base strategy, except that the levels of stop profit and stop loss were set to 35 cents above and 50 cents below the entry price, respectively. The change was able to improve PnL and other performance indicators.

Fig. 3. Strategy PnL

Fig. 4. Strategy Statistics

Instead of using constant values, we could also set stop profit/loss levels to be dependent on the TD Setup trend range. The TD setup trend (TDST) is the price extremes during the setup stage of the TD signal. The magnitude of this range reflects the volatility of stock prices in the time period of the signal recognition process.

In the backtest below, the rule is to exit the market once the low price exceeds the entry price by two times the TDST range, or falls below the entry price by one TDST range.

Fig. 5. Strategy PnL

Compared with the base strategy, modifying the exit rule improved strategy PnL in the backtest period. Performance in February and March improved significantly. The daily return was less volatile in the following three months compared with the strategy using constant-level exit rules although the overall trend was slightly declining. However, the PnL drop at the start of the year still existed, and the strategy still had large drawdowns.

Table 2. Strategy Statistics

As could be seen from the chart above, the number of trades dropped by around a half after the exit rule is changed and the average trade duration increased greatly. Consequently, total commission paid was lower, and the magnitude of maximum daily gains and losses were higher.

3. Using high, low and close of minute bar

In the base strategy, close prices are used to recognize buy signals, and minute low prices are used for the calculation of whether stop profit/loss levels have been reached. If close prices are used to determine when to exit instead of low prices, it will be easier to hit stop profit and harder to hit stop loss. A comparison of the backtest result, holding other parameters unchanged, is as follows:

Fig. 6. Strategy PnL

Table 3. Strategy Statistics

In this case, the number of trades increased from 226 to 247, but the Sharpe Ratio dropped from 0.87 to 0.85. Greater PnL was achieved in the first quarter, but there was also a greater loss in the second quarter.

Fig. 7. Return distribution using low prices

Fig. 8. Return distribution using close prices

4. Changing trade positions

We could also change positions traded in the strategy instead of using constant values. For example, we could adjust positions so that a fixed percentage of capital is invested for each trade. Below is the backtest result where the percentage of traded capital was set to 20%.

Fig. 9. Strategy PnL

5. Adding TD countdown stage and more rules to the signal

Some details in the rules of the TD sequential strategy, including whether to execute the countdown stage for the determination of the trading signal, or to wait for a bear flip before entering a position, affects the length of the minute bars required for signal recognition and thus will have an impact on the strategy PnL.

The following strategy requires a new low to be reached in the last two bars of the setup stage before entering a long position, and uses TDST range to calculate stop prfit/loss levels. Result of the backtest shows that this additional rule doesn’t seem to increase the trade win probability, and the change in the number of trades and strategy PnL is minor.

Fig. 10. Strategy PnL

Table 4. Strategy Statistics

Adding countdown stage to the strategy greatly increases the length of bars required for buy signal recognition. Based on the result of the backtests, this step doesn’t help to increase the probability of recognizing a successful trade, nor does it improve backtest PnL.


  • ed854585ed854585 Posts: 22

    III. Using Social Sentiment Data to modify TD Sequential Strategy

    Bloomberg Event-Driven Feed Social Analytics is a dataset that measures collective social sentiment. It measures investors’ sentiment in holding stocks after reading financially relevant tweets using score and confidence level. Sentiment data could be interpreted as a prediction of short-term stock market movement, and may be helpful in determining whether it is a good time to enter the market.

    In this part, the TD sequential strategy is modified so that the stock is traded based on the TD buy signal as well as social sentiment data. When the pattern of stock minute bars is recognized as a TD sequential buy signal, sentiment up to that time is evaluated, so as to avoid buying stock when the social sentiment is generally negative. At any given time, available same-day sentiment time series is converted to a single value and be compared to a predefined threshold. Earlier information is assigned a lower weight in the calculation of the current sentiment. The weight decays exponentially as the sentiment information becomes older.

    In the backtest below, exit rule same as the one mentioned in part II was used (with the use of TDST range). The threshold for the weighted sentiment score was 2.0.

    Fig. 11. Strategy PnL

    Fig. 12. Strategy Return Distribution

    Using sentiment data reduced the number of trades and lowered the volatility of strategy PnL. The volatility of returns in the backtest period dropped from 11.50% to 8.87% compared with the performance without sentiment data, improving the Sharpe ratio. The maximum drawdown also decreased from 8.5% to 2.7%. As could be seen from the distribution plots above, strategy with sentiment data had fewer large negative returns.

    Table 5. Strategy Statistics

    Table 6. Threshold Comparison

    Including the sentiment data didn’t help to improve the probability of getting positive PnL from a trade, but it did decrease the number of trades with big losses.

    The plot below demonstrated performance of the strategy same as above but traded six liquid tech stocks: AAPL, MSFT, FB, CSCO, TWTR and INTC.

    Fig. 13. Strategy PnL

    Table 7. Strategy Statistics


    [1] Perl, J., & DeMark, T. R. (2008). TD Sequential: Defining the Trend and Identifying Exhaustion Points. DeMark Indicators, 1-27.

  • jd623170jd623170 Posts: 14

    Thanks for publishing this study. It is a very good overview of a systematic way to review how your algo is improving and what statistics to review.

  • Hi there, I’ve recently completed research into demark sequential combo. You can see my results at Free excel download, requires Office 365 enabled macros to run.

Sign In or Register to comment.