mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
fix: fix pivothigh indicator use high instead of low
This commit is contained in:
parent
78299a6e7d
commit
f62eb301e3
|
@ -13,8 +13,8 @@ type PivotHigh struct {
|
|||
|
||||
types.IntervalWindow
|
||||
|
||||
Highs floats.Slice
|
||||
Values floats.Slice
|
||||
Highs floats.Slice
|
||||
Values floats.Slice
|
||||
EndTime time.Time
|
||||
|
||||
updateCallbacks []func(value float64)
|
||||
|
@ -43,13 +43,13 @@ func (inc *PivotHigh) Update(value float64) {
|
|||
return
|
||||
}
|
||||
|
||||
low, ok := calculatePivotHigh(inc.Highs, inc.Window, inc.RightWindow)
|
||||
high, ok := calculatePivotHigh(inc.Highs, inc.Window, inc.RightWindow)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
if low > 0.0 {
|
||||
inc.Values.Push(low)
|
||||
if high > 0.0 {
|
||||
inc.Values.Push(high)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,7 @@ func (inc *PivotHigh) PushK(k types.KLine) {
|
|||
return
|
||||
}
|
||||
|
||||
inc.Update(k.Low.Float64())
|
||||
inc.Update(k.High.Float64())
|
||||
inc.EndTime = k.EndTime.Time()
|
||||
inc.EmitUpdate(inc.Last())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user