Ok,
I guess that linearreg is built not taking into consideration the time axis. Is more like the linear regression of all point as they appear at the same instant. I could be wrong and I would wait some input from people more expert than me, but I guess that you can find two points of the line you are looking for using two simple call:

var Point1 = LinearReg(Price, 500);
var Point2 = LinearReg(Price, 1000);
connecting point 1 and point 2 should be an approximation "your" line.

Try if it answer your point, if it does not double check the TA-Lib source code of the indicator in order to understand what the indicator really does or start from the math to code a new indicator that will suit your need.

If you are looking for a channel breakout strategy, I guess that dr_panther will be the proper approach, because you may be looking for a channel that will adapt to market conditions...

Ciao