bbgo: add CCI helper

This commit is contained in:
c9s 2022-07-26 18:04:57 +08:00
parent f5e64e8e70
commit 808d742efc
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 6 additions and 2 deletions

View File

@ -93,10 +93,15 @@ func (s *StandardIndicatorSet) ATRP(iw types.IntervalWindow) *indicator.ATRP {
} }
func (s *StandardIndicatorSet) EMV(iw types.IntervalWindow) *indicator.EMV { 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) 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 { func (s *StandardIndicatorSet) STOCH(iw types.IntervalWindow) *indicator.STOCH {
inc, ok := s.stoch[iw] inc, ok := s.stoch[iw]
if !ok { if !ok {

View File

@ -78,7 +78,6 @@ func (inc *CCI) Length() int {
var _ types.SeriesExtend = &CCI{} var _ types.SeriesExtend = &CCI{}
func (inc *CCI) PushK(k types.KLine) { func (inc *CCI) PushK(k types.KLine) {
inc.Update(k.High.Add(k.Low).Add(k.Close).Div(three).Float64()) inc.Update(k.High.Add(k.Low).Add(k.Close).Div(three).Float64())
} }