From 808d742efca057f166872dfcd1810eda35e4543b Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 26 Jul 2022 18:04:57 +0800 Subject: [PATCH] bbgo: add CCI helper --- pkg/bbgo/standard_indicator_set.go | 7 ++++++- pkg/indicator/cci.go | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/bbgo/standard_indicator_set.go b/pkg/bbgo/standard_indicator_set.go index 893ea7247..5df32a7b5 100644 --- a/pkg/bbgo/standard_indicator_set.go +++ b/pkg/bbgo/standard_indicator_set.go @@ -93,10 +93,15 @@ func (s *StandardIndicatorSet) ATRP(iw types.IntervalWindow) *indicator.ATRP { } func (s *StandardIndicatorSet) EMV(iw types.IntervalWindow) *indicator.EMV { - inc := s.allocateSimpleIndicator(&indicator.ATRP{IntervalWindow: iw}, iw) + inc := s.allocateSimpleIndicator(&indicator.EMV{IntervalWindow: iw}, iw) return inc.(*indicator.EMV) } +func (s *StandardIndicatorSet) CCI(iw types.IntervalWindow) *indicator.CCI { + inc := s.allocateSimpleIndicator(&indicator.CCI{IntervalWindow: iw}, iw) + return inc.(*indicator.CCI) +} + func (s *StandardIndicatorSet) STOCH(iw types.IntervalWindow) *indicator.STOCH { inc, ok := s.stoch[iw] if !ok { diff --git a/pkg/indicator/cci.go b/pkg/indicator/cci.go index d7165037a..6a75ff563 100644 --- a/pkg/indicator/cci.go +++ b/pkg/indicator/cci.go @@ -78,7 +78,6 @@ func (inc *CCI) Length() int { var _ types.SeriesExtend = &CCI{} - func (inc *CCI) PushK(k types.KLine) { inc.Update(k.High.Add(k.Low).Add(k.Close).Div(three).Float64()) }