diff --git a/pkg/indicator/sma.go b/pkg/indicator/sma.go index 1d3c0a7b6..ee87cb17c 100644 --- a/pkg/indicator/sma.go +++ b/pkg/indicator/sma.go @@ -24,6 +24,9 @@ type SMA struct { } func (inc *SMA) Last() float64 { + if len(inc.Values) == 0 { + return 0.0 + } return inc.Values[len(inc.Values)-1] }