People who are not knowledgeable in mathematics like to think that a definition of trend is as straightforward as it gets.
For example I skimmed through one of the major popular books on trendfollowing and it is full of babble about trends.
The problem is that trends are a very perplexing thing. All the confusion arise from the disregard of the random nature of the process.
One should start any observation with the statement: asset prices are a random process. That is to say that one part of the outcome will always be unknown. It doesn't mean that everything will be unknown. The standard recipe for random proceccess is the brownian motion.
The following picture shows a simulation of a brownian motion with mu = 1 and sigma = 0.3 and sigma = 0.9. Both markets trend, which simply means that mu is not zero. However the ratio of mu to sigma is a measure for strength of the trends. Trends are
not binary, they have a spektrum. In fact they are multidimensional: they can be meanreverting, autocorrelating, correlating, cointegrating, etc. However often sophisticated stochastic calculus misses some very basic things.
Chan writes in his excellent book:
For example I skimmed through one of the major popular books on trendfollowing and it is full of babble about trends.
The problem is that trends are a very perplexing thing. All the confusion arise from the disregard of the random nature of the process.
One should start any observation with the statement: asset prices are a random process. That is to say that one part of the outcome will always be unknown. It doesn't mean that everything will be unknown. The standard recipe for random proceccess is the brownian motion.
The following picture shows a simulation of a brownian motion with mu = 1 and sigma = 0.3 and sigma = 0.9. Both markets trend, which simply means that mu is not zero. However the ratio of mu to sigma is a measure for strength of the trends. Trends are
not binary, they have a spektrum. In fact they are multidimensional: they can be meanreverting, autocorrelating, correlating, cointegrating, etc. However often sophisticated stochastic calculus misses some very basic things.
Chan writes in his excellent book:
Okay, you say, you donât need an advanced degree, but surely
it gives you an edge in statistical arbitrage trading? Not necessarily.
I received a PhD from one of the top physics departments of the
world (Cornellâs). I worked as a successful researcher in one of the
top computer science research groups in the world (at that temple of
high-techdom: IBMâs T. J. Watson Research Center). Then I worked
in a string of top investment banks and hedge funds as a researcher
and finally trader, including Morgan Stanley, Credit Suisse, and so
on. As a researcher and trader in these august institutions, I had always
strived to use some of the advanced mathematical techniques
and training that I possessed and applied them to statistical arbitrage
trading. Hundreds of millions of dollars of trades later, what
was the result? Losses, more losses, and losses as far as the eye can
see, for my employers and their investors. Finally, I quit the financial
industry in frustration, set up a spare bedroom in my home as
my trading office, and started to trade the simplest but still quantitative
strategies I know. These are strategies that any smart high
school student can easily research and execute. For the first time
in my life, my trading strategies became profitable [...], and has been the case ever since. The
lesson I learned? As Einstein said: âMake everything as simple as
possible.â But not simpler.
Code:
'''
N_sim: number of simulations
T: horizon
dt: step length in years
sigma: volatility per year
mu: drift terms (moving average or long-term mean for stock returns)
S0: initial stock price
'''
from numpy.random import standard_normal
from numpy import array, zeros, sqrt, shape
from pylab import *
S0 = 10.222
T =1
dt =0.0002
#sigma = 0.4
#mu = 4 #1
N_Sim = 5
Steps=round(T/dt); #Steps in years
def plot_brown(sigma,mu):
title('Simulations %d Steps %d Sigma %.6f Mu %.6f S0 %.6f' % (int(N_Sim), int(Steps), sigma, mu, S0))
S = zeros([N_Sim, Steps], dtype=float)
x = range(0, int(Steps), 1)
for j in range(0, N_Sim, 1):
S[j,0]= S0
for i in x[:-1]:
S[j,i+1]=S[j,i]+S[j,i]*(mu-0.5*pow(sigma,2))*dt+sigma*S[j,i]*sqrt(dt)*standard_normal();
plot(x, S[j])
if __name__=='__main__':
subplot(211)
plot_brown(0.3,1)
subplot(212)
plot_brown(0.9,1)
xlabel('steps')
ylabel('stock price')
show()