mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
bbgo: add CCI helper
This commit is contained in:
parent
f5e64e8e70
commit
808d742efc
|
@ -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 {
|
||||||
|
|
|
@ -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())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user