Regression line

I would like the ability to create a regression line and the corresponding channel from several selected points rather than every bar between start and end. As an example, I would pick the lows or highs of 5 selected bars out of a group of 40 contiguous bars to calculate a regression line - then add a channel on either side. The idea is to create a line that represents the best fit for those 5 bars.