Delta / Change

All functions · nseries package

Delta

func (s Series) Delta(n ...int) Series

Delta computes the difference between each value and the value n entries back. By default, n is one.

The warm-up reads 0, not NaN: bars 0 to n-1 are 0, no change, with n defaulting to 1.

DeltaPercent

func (s Series) DeltaPercent(n ...int) Series

DeltaPercent computes the percentage difference between series elements.

The output is a percentage, (s[i] - s[i-n])/s[i-n]*100. The warm-up reads 0, not NaN: bars 0 to n-1 are 0.