ema

package
v0.0.0-...-db5d468 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2023 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EMA

type EMA struct {
	// contains filtered or unexported fields
}

Implement an exponentially moving average to the likes of the writer. Because there's millions of implementations so what's wrong with yet another one.

func NewEMA

func NewEMA(n_p95 int) *EMA

New Exponentially Moving Average. The argument is the amount of samples we'll keep, and it's defined as the number for which the n-th old sample would have a weight of 5%, the point at which we discard it. The 0-th sample has got a weight of 1.

func NewEMI

func NewEMI(n_p95 int) *EMA

New Exponentially Moving Integral. Works the same as the EMA does, but without dividing by the total weight at the end.

func (*EMA) Add

func (ema *EMA) Add(value float64)

func (*EMA) Value

func (ema *EMA) Value() float64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL