Fitting A Trendline By Least Squares
by Arthur A. Merrill, C.M.T.
Usually, trendlines are drawn through tops or bottoms. They are also drawn through the center of
prices by a lagged moving average or by eye (Figure 1). A straight line through the center of a price
channel, if the scale is logarithmic, will give you the percentage growth or decline rate.
If the straight line is drawn by eye, it is subject to debate. This question can be resolved by a
mathematically calculated line called "least squares" (Figure 2). The deviations of the points from the line
are marked A, B, C, D and E in Figure 2. The line produced by the least squares calculation reduces the
sum of the squares of these deviations to a minimum, hence the name "least squares."
The formula for a straight line is:
Y = a + bX
where X is the value of the X (horizontal) axis. When X is zero, Y equals a, which is called the Y
intercept (Figure 3). The distance from this level up to the line is bX, which is directly proportional to b,
the slope of the line.