diff --git a/pkg/indicator/v2_ewma.go b/pkg/indicator/v2_ewma.go index 45a15d7ca..16feb9901 100644 --- a/pkg/indicator/v2_ewma.go +++ b/pkg/indicator/v2_ewma.go @@ -19,6 +19,10 @@ func EWMA2(source Float64Source, window int) *EWMAStream { func (s *EWMAStream) Calculate(v float64) float64 { last := s.slice.Last(0) + if last == 0.0 { + return v + } + m := s.multiplier return (1.0-m)*last + m*v }