Rate of Change

All functions · nseries package

RateOfChange

func (s Series) RateOfChange(n int) Series

RateOfChange computes the percentage rate of change over n bars. The result is ((current / n-bars-ago) - 1) * 100.

The output is a percentage, (s[i]/s[i-n] - 1)*100, which can differ from DeltaPercent in the last bit. The warm-up reads 0, not NaN: bars 0 to n-1 are 0.