Welcome to our Knowledge Base

Optimal Trend Following Trading Rules

You are here:
< last topic

Optimal Trend Following Trading Rules

Trading strategies can be classified as i) the buy and hold strategy, ii) the contra-trending strategy, and iii) the trend following strategy.

  • Buy and hold strategy: an investment strategy in which an investor buys stocks and holds them for a long period regardless of fluctuations in the market.
  • Contra-trending strategy: Investor purchases shares when prices fall to some low level and sells when they go up to a certain high level (known as buy-low-sell-high).
  • Trend following strategy: Investor enters the market in the uptrend and signal investors to exit when the trend reverses (known as buy-high-sell-higher).

Trend Following Strategy 

Among three strategies, the trend following strategy performs better than the others.

In short, trend and following strategy is an alternative way of buy and hold, which requires investors look at a long-term trend happening in the market rather than ignoring what happens in the market. It has a significant higher return rate compared with the buy and hold strategy which can be quantified by the optimal trend following trading rule in the paper.

Comparing with contra-trending strategy, trend and following allows investors having a rather flexible time of entries and exits. What trend and following cares is a long-term movement rather than the exact time. It is difficult to pinpoint the best time to buy or sell a stock if the investor follows the contra-trending rule.

In summary, the trend following strategy has following main advantages:

  • Higher return rate
  • Less time-consuming
  • Catch trend from the very beginning

Development of Trend Following Strategy

Dai et al. [2] provided a theoretical justification of the trend following strategy in a bull-bear switching market and employed the conditional probability in the bull market to generate the trade signals. However, in this justification only one share of stock is allowed to be traded. As a result, the optimal trend following trading rules were developed to remove the restriction.

The paper discusses two circumstance:

  1. Only long and flat positions are allowed
  2. Short selling is also allowed, long and short are mixed

The paper aims to maximize the expected return of the terminal wealth by considering a finite horizon investment problem.

First, it models the trends in market using switching process and two regimes to describe the stock price \(S_r\) at time \(r\):

\(dS_r = S_r[\mu(\alpha_r)dr + \sigma dB_r], S_t = X, t \le T \le \infty\)

  • Two regimes: the uptrend (bull market) and downtrend (the bear market). \(\mu(i) \equiv \mu_i\) is the return rate in two regimes. \(i=1\) represents the uptrend (bull market) and \(i=2\) represents the downtrend (the bear market).
  • Switching process: \(\alpha_r\in\{1,2\}\) represents a two-state Markov chain, which is not directly observable.

Authors use the sequence of stopping times indicating the time of entering and exiting long positions:


  • If the initial position is long (\(i=1\)), sequence of stopping time is \(\Lambda_1=(\nu_1, \tau_2, \nu_2,\tau_3,\cdots)\)
  • If the initial position is flat (\(i =0\)), sequence of stopping time is \(\Lambda_0 =(\tau_1, \nu_1, \tau_2, \nu_2, \cdots)\)

Second, the reward functions of the decision sequences are

J_i(S, \alpha, t, \Lambda_i) \left\{
E_t\bigg\{log\bigg(e^{\rho(\tau_1-t)}\prod_{n=1}^\infty e^{\rho(\tau_{n+1}-\nu_n)}\frac{S_{\nu_n}}{S_{\tau_n}}\Big[\frac{1-K_s}{1+K_b}\Big]^{I_{\{\tau_n<T\}}}\bigg)\bigg\}, if \ i = 0\\
E_t\bigg\{log\bigg(\Big[\frac{S_{\nu_1}}{S}e^{\rho(\tau_2-\nu_1)}(1-K_s)\Big]\prod_{n=2}^\infty e^{\rho(\tau_{n+1}-\nu_n)}\frac{S_{\nu_n}}{S_{\tau_n}}\Big[\frac{1-K_s}{1+K_b}\Big]^{I_{\{\tau_n<T\}}}\bigg)\bigg\}, if \ i = 1

and the goal is to maximize the reward functions.

Since the market trend \(\alpha_r\) in the reward functions \(J_i(S, \alpha, t, \Lambda_i)\) is not observable, authors would like to convert the problem into a completely observable one using conditional probability by Wonham filter, in order to numerically solve the problem. Let \(p_r=P(\alpha_r=1|S_r)\) denotes the conditional probability.

Then the problem converts to choose \(\Lambda_i\) to maximize the discounted return as following:

\(J_i(S, p ,t, \Lambda_i) \equiv J_i(S, \alpha, t, \Lambda_i)\)

Third, let \(V_i(p, t)\) denote the value function with net positions \(i = 0, 1\) at time \(t\). That is

\(V_i(p, t) = \underset{\Lambda_i}{sup}J_i(S, p, t, \Lambda_i)\)

Then authors introduce Hamilton-Jacobi-Bellman equations to solve sell and buy boundaries \(p_s^*(\cdot)\) and \(p_b^*(\cdot)\) respectively:

\(V_0(p, t) = \underset{\tau_1}{sup}E_t\{\rho(\tau_1-t) – log(1+K_b)+V_1(p_{\tau_1}, \tau_1)\}\)

\(V_1(p, t) = \underset{\nu_1}{sup}E_t\Big\{\int_t^{\nu_1}f(p_s)ds+log(1-K_s)+V_0(p_{\nu_1}, \nu_1)\Big\}\)

where the thresholds \(p_s^*(\cdot)\) and \(p_b^*(\cdot)\) can be obtained through solving above system of HJB equations.

Using the similar steps, authors obtain the trading strategy adding shorts and it can be applied to reality.

Application in Reality

  • The simulation result shows that the average returns of trend following is 75.76, which is far more than buy and hold strategy with average return 5.62.
  • The market test result shows that in both SP500 and SSE indices, trending following results (annualized return 11.03% and 14.0% respectively) perform better than buy and hold strategy (annualized return 9.80% and 2.58% respectively).
  • In the situation that long and short are both added, the simulation result shows that it improves the performance considerably. However, when it turns to market tests, although SSE yields annualized return 18.48% remaining satisfying, SP500 only gives 2.57% which is worse than buy and hold with annualized return 8.57%. So, we do not suggest mixing short and long in real trading.


[1] M. Dai, Q. Zhang, and Q. Zhu, Optimal Trend Following Trading Rules, Mathematics of Operations Research, INFORMS, vol. 41(2), pp. 626-642, (2016).


[2] M. Dai, Q. Zhang, and Q. Zhu, Trend following trading under a regime switching model, SIAM Journal on Financial Mathematics, 1, pp. 780-810, (2010).


Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents

Leave a Reply

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