Tools: Linear Regression Lines and Channel
To draw a Linear Regression line on a chart, click the Linear Regression button. The cursor will change to a pencil while in the draw mode. Move the cursor pencil to a starting bar and then click the left mouse button and drag to an ending bar point. The line will stay selected until the mouse is clicked somewhere else on the screen. At that point, the regression line will be calculated and the line will be repositioned. The price levels for the starting and ending points will be determined by the Linear Regression formula. The formula uses the bar prices between the start and end points to calculate a straight line best fit using the least squares method. Line parameters can be set to extend the regression line forward and back, to mirror at different angles, and to change the color.
Adjusting a Line: Re-selecting the Regression Line will activate the ability to move and adjust it to a different location. Click the mouse on the Line to activate it. The cursor will change to a pencil and square bullets will mark the start and end points. Drag the square bullets to a new location and the Line will adjust. Drag the line from the center to move the whole line at once.
Properties Window: After drawing a Regression Line on a chart, click the Chart Objects button, select Linear Regression, and then click Properties to view the properties window. The properties window can also be displayed by re-selecting the line and then right-clicking the mouse. The following options are available on the right side of the properties window:
- Use MidPoint - Uses the Midpoint of the bar (High+Low)/2 instead of the close, for calculations
- Auto Tracking - Will move the Regression line to the right as each new bar is completed. The start and end points remain a constant distance apart. For example, a 10 bar Regression line will recalculate to the most current 10 bars at the completion of each new bar.
- Auto Extending - Will leave the start point in place, and extend the end point to the most recently completed bar. The distance between the start and end point will increase as new bars are completed.
- H/L Channel - Place a check mark here to plot parallel lines from the High and Low points surrounding the Regression line. This makes a nice set of channel lines. The color of the channel lines can be changed with the 'Std Dev Channel' and 'Mult' color boxes.
- PTT Channel - A Price Time Target line can be plotted on the chart by selecting this box. Ensign will find a swing point between the start and end points of the Regression line, and plot a parallel line from this swing point.
- Points Channel - Parallel channel lines can be plotted by selecting this box, and the 'Show' box for points channel. Specify the price distance in the 'Pts.' entry box. Lines will be drawn at this price distance away from the main Regression line. This box will toggle the lines between 'Percent Channel lines' and 'Points Channel lines'.
- Price A- The 'Price' box displays the starting price for the line.
- Price B- Displays the ending price for the line.
- Extend Multiplier - Enter a multiplier. The Regression line will be extended forward/back by this multiplier amount.
- Custom Label - Place a check mark in this box to display custom labels. Enter the label text in the entry boxes in the Left Side and Right Side marker columns (on the Custom Label row).
- Above/Below - Causes the custom labels to print above or below the line (adjusts the location)
A Linear Regression (LR) line is a trend line that is drawn mathematically so that is represents the 'best fit' for the data points it passes through. The formulas use the least squares method to determine the line's placement. This minimizes the distances between the data points and the trend line.
The algebraic expression for a straight line is: y = b * x + a where b is the slope of the line and a is the y-intercept. The linear regression formula calculate both the b and the a values.
This chart shows a linear regression trend line in its 'best fit' position.
One technique is to draw equally spaced channel lines at a distance based on Standard Deviation. The Linear Regression draw tool in Ensign Windows has a multiplier parameter for the Standard Deviation offset. The following example shows red channels lines drawn at 2 times the Standard Deviation. Prices that stay outside of the regression channel indicate a change in trend.
The next technique that is based on Linear Regression trend lines, is to calculate a Linear Regression line for every set of n bars, and determine the price where the trend line intercepts the last bar in each data set. Thus, one data point is determined for each bar in the chart, and these data points are then connected to create a Linear Regression curve, quite like a moving average. The next chart illustrates several LR lines that each span a set of 5 bars. The price where the LR line intercepts the last bar in each set of 5 bars is marked with a dot. These intercept points are then connected by the red line to form a curve.
Click on the Study button to show the list of studies. The study in Ensign Windows which is based on the above technique is called Regression Channel. The center line is calculated as illustrated in the prior example. Then bands are added whose distance from the regression center line is based on Standard Deviation.
The last technique discussed in this article is to plot the Slope of each Linear Regression trend line that is calculated for each set of n bars. In our earlier example with several LR lines, each LR line has a slope. Some have positive slopes wherein the lines are ascending. Some have negative slopes wherein the lines are descending. A change in the slope can be an early indication that the trend is changing direction.
This example shows the Regression Channel, with the Linear Regression Slope study plotted in green.
The Linear Regression Slope (LRS) is a plot of the b values calculated for each set of n bars. In the last 3 illustrations, n had a value of 5. This small set size makes for a choppy channel and a choppy LRS. The lead article in this newsletter is a better example of how the LRS will look on a chart, and the set size parameter will be more useable when in the neighborhood of 10.
Ensign Windows users who would like to investigate the Linear Regression Slope study would select the Regression Channel from the study list, and check the Plot Slope (LRS) check box on the study property form. The LRS will be plotted instead of the Regression Channel. Upper and Lower bands may be added to the plot.
| contact us
Ensign Software, Inc., 113 Stillwater Drive, Idaho Falls, ID 83404 Support: 801-328-1382 Billing: 208-552-2230
(c) 2014 Ensign Software, Inc. All Rights Reserved
Last modified 8/4/11 3:35 PM