As we all know, the trend is our friend… until it ends! The crucial part of any trading strategy then, is to be on the right side of the trend to capture profits. There are many different indicators and philosophies to detect trends and trend strength. In this article, we will take a look at the Trend Continuation Factor (TCF) by M.H. Pee, who introduced this indicator many years ago in the magazine “Technical Analysis of Stocks & Commodities”.
Idea behind the Trend Continuation Factor (TCF)
The Trend Continuation Factor is a tool for detecting trends and consolidations. The philosophy behind this indicator is simple and clear. Prices tend to close higher during uptrends, so the sum of positive changes will significantly outnumber the sum of negative changes in strong uptrends (and vice versa) over the past n days.
If you are familiar with the directional movement indicator (DMI) by Welles Wilder, you will find similarities. Both indicators consist of two components, one showing the bullish trend, the other showing the bearish trend – each taking into account the magnitude of price changes and the frequency of the prices closing in the same direction.
Practical Examples for Uptrend, Downtrend and Consolidation
In the first example we take a look at the German Baseload Cal20 contract in a strong uptrend environment. The bullish component of the 50-day TCF (green) is way above the zero line thus signalling a strong uptrend.
The next chart below shows a strong downtrend, since the bearish 50-day TCF (red) is above zero for the most part.
The last example shows a consolidation period, which exists when both components of the TCF are below zero.
Calculation and Coding in Equilla
Now that we have seen how the indicator works, it`s time for some coding. This is not too difficult. The calculation first takes into account the difference between the closing prices of the last two days (line 11). These changes are then separated into two groups (UpChg and DownChg). So, for example, if today`s close is higher than yesterday`s close, the variable UpChg will have a value equal to the difference, while DownChg will have a value of zero and vice versa (line 14 and 15).
Next, in line 18 and 19 we calculate the positive and negative factors. If UpChg is zero today, the UpChgFactor is also zero, otherwise it equals the value of the sum of todays UpChg and its value from yesterday.
In the last step, the bullish Trend Continuation Factor (UpTCF) is calculated in line 13. This is done by summing up the UpChg for the last n days and subtracting the sum of the DownChgFactor. The same logic applies for calculation of the bearish part of the TCF (DownTC) in line 14. Both components of the TCF are based on the chosen lookback period parameter I called FactorPeriod.
By the way: If you want to create a simple trading strategy for backtesting this indicator, you can add lines 33 to 41 to the code.
Tradesignal® is a registered trademark of Tradesignal GmbH. Unauthorized use or misuse is strictly prohibited. Data by Refinitiv Eikon.