indicator/ma_group.go

27 lines
422 B
Go
Raw Permalink Normal View History

2024-06-25 15:17:36 +00:00
package indicator
type MAGroup struct {
fast Indicator
slow Indicator
}
func NewMAGroup(fast, slow Indicator) *MAGroup {
mg := new(MAGroup)
mg.fast = fast
mg.slow = slow
return mg
}
func (mg *MAGroup) Update(price float64) {
mg.fast.Update(price)
mg.slow.Update(price)
}
func (mg *MAGroup) FastResult() float64 {
return mg.fast.Result()
}
func (mg *MAGroup) SlowResult() float64 {
return mg.slow.Result()
}