zig zag and linear regression channel.

 
i would like when a zig zag line ends, then automatically a linear regression channel to be created based on bottom and top of zig zag line. time frame mainly one hour. is that possible? and in affirmative how?
Reason: