code: func calcTrendValue(i int, sf, tf, s0, s1, b float64) float64 {
  	if i == 0 {
  		return b
  	}
  
  	x := tf * (s1 - s0)
  	y := (1 - tf) * b
  
  	return x + y
  }
docs: // Calculate the trend value at the given index i in raw data d.
  // This is somewhat analogous to the slope of the trend at the given index.
  // The argument "s" is the set of computed smoothed values.
  // The argument "b" is the set of computed trend factors.
  // The argument "d" is the set of raw input values.