working code. changed the trendline to act on completed scope.