Skip to content

Commit 578e4b2

Browse files
committed
indicator: fix pivot low indicator
1 parent 605c665 commit 578e4b2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pkg/indicator/pivot_low.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ type PivotLow struct {
2121
updateCallbacks []func(value float64)
2222
}
2323

24+
func (inc *PivotLow) Length() int {
25+
return inc.Values.Length()
26+
}
27+
28+
func (inc *PivotLow) Last() float64 {
29+
if len(inc.Values) == 0 {
30+
return 0.0
31+
}
32+
33+
return inc.Values.Last()
34+
}
35+
2436
func (inc *PivotLow) Update(value float64) {
2537
if len(inc.Lows) == 0 {
2638
inc.SeriesBase.Series = inc
@@ -53,7 +65,6 @@ func (inc *PivotLow) PushK(k types.KLine) {
5365
inc.EmitUpdate(inc.Last())
5466
}
5567

56-
5768
func calculatePivotLow(lows types.Float64Slice, window int) (float64, error) {
5869
length := len(lows)
5970
if length == 0 || length < window {

0 commit comments

Comments
 (0)