Skip to content

Commit 65cd17d

Browse files
committed
bbgo: add G-H & Kalman filters to the standard indicator set
1 parent 425d9e0 commit 65cd17d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/bbgo/standard_indicator_set.go

+13
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,16 @@ func (s *StandardIndicatorSet) BOLL(iw types.IntervalWindow, bandWidth float64)
147147

148148
return inc
149149
}
150+
151+
// GHFilter is a helper function that returns the G-H (alpha beta) digital filter of the given interval and the window size.
152+
func (s *StandardIndicatorSet) GHFilter(iw types.IntervalWindow) *indicator.GHFilter {
153+
inc := s.allocateSimpleIndicator(&indicator.GHFilter{IntervalWindow: iw}, iw, "ghfilter")
154+
return inc.(*indicator.GHFilter)
155+
}
156+
157+
// KalmanFilter is a helper function that returns the Kalman digital filter of the given interval and the window size.
158+
// Note that the additional smooth window is set to zero in standard indicator set. Users have to create their own instance and push K-lines if a smoother filter is needed.
159+
func (s *StandardIndicatorSet) KalmanFilter(iw types.IntervalWindow) *indicator.KalmanFilter {
160+
inc := s.allocateSimpleIndicator(&indicator.KalmanFilter{IntervalWindow: iw, AdditionalSmoothWindow: 0}, iw, "kalmanfilter")
161+
return inc.(*indicator.KalmanFilter)
162+
}

0 commit comments

Comments
 (0)