func (r *MaxFilter) Get() float64 {
	if r.count == 0 {
		return 0
	}
	records := r.records
	if r.count < r.size {
		records = r.records[:r.count]
	}
	max, _ := stats.Max(records)
	return max
}
Get returns the maximum of the data set.
package movingaverage
import "github.com/montanaflynn/stats"
type MaxFilter struct {
	records []float64
	size    uint64
	count   uint64
}
func NewMaxFilter(size int) *MaxFilter {
	return &MaxFilter{
		records: make([]float64, size),
		size:    uint64(size),
	}
}
func (r *MaxFilter) Add(n float64) {
	r.records[r.count%r.size] = n
	r.count++
}