A way to calculate a straight line that best fits a set of data (such as closing prices over a certain period) — that is, a line that most accurately reflects the slope, or trend, of the data.
A regression line is calculated using the “least squares” method, which refers to finding the minimum squared (x*x, or x2) differences between price points and a straight line. For example, if two closing prices are 2 and 3 points away (the distance being calculated vertically) from a straight line, the squared differences between the points and the line are 4 and 9, respectively.
The squared differences are used (instead of just the differences) because some differences are negative (for points below the line) and others are positive (for points above the line). Squaring all the differences creates all-positive values and allows you to calculate a formula for the straight line.
The “best-fit” line is the line for which the sum of the squared differences between each price and the straight line are minimized.
The formula for a straight line (y) is:
y = a + b*t where,
t = time
a = the initial value of the line when “t” is equal to zero (sometimes called the “intercept” value — i.e., the point at which the line intercepts the vertical y-axis) or the point at which a specific line begins
b = the slope of the line, which is the rate at which the line rises or falls (e.g., 0.75 points per day).
Subscribe to:
Post Comments (Atom)
Post a Comment