Merge pull request #1047 from c9s/narumi/add-rsi

feature: add RSI to StandardIndicatorSet
This commit is contained in:
Yo-An Lin 2023-01-07 19:25:56 +08:00 committed by GitHub
commit 9ee4fa0064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,6 +167,11 @@ func (s *StandardIndicatorSet) MACD(iw types.IntervalWindow, shortPeriod, longPe
return inc
}
func (s *StandardIndicatorSet) RSI(iw types.IntervalWindow) *indicator.RSI {
inc := s.allocateSimpleIndicator(&indicator.RSI{IntervalWindow: iw}, iw, "rsi")
return inc.(*indicator.RSI)
}
// GHFilter is a helper function that returns the G-H (alpha beta) digital filter of the given interval and the window size.
func (s *StandardIndicatorSet) GHFilter(iw types.IntervalWindow) *indicator.GHFilter {
inc := s.allocateSimpleIndicator(&indicator.GHFilter{IntervalWindow: iw}, iw, "ghfilter")