indicator: make right window optional

This commit is contained in:
c9s 2023-10-16 12:40:44 +08:00
parent 4c69dccf09
commit dfa3f7d4c4
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 12 additions and 2 deletions

View File

@ -11,7 +11,12 @@ type PivotHighStream struct {
window, rightWindow int window, rightWindow int
} }
func PivotHigh2(source types.Float64Source, window, rightWindow int) *PivotHighStream { func PivotHigh(source types.Float64Source, window int, args ...int) *PivotHighStream {
rightWindow := window
if len(args) > 0 {
rightWindow = args[0]
}
s := &PivotHighStream{ s := &PivotHighStream{
Float64Series: types.NewFloat64Series(), Float64Series: types.NewFloat64Series(),
window: window, window: window,

View File

@ -11,7 +11,12 @@ type PivotLowStream struct {
window, rightWindow int window, rightWindow int
} }
func PivotLow(source types.Float64Source, window, rightWindow int) *PivotLowStream { func PivotLow(source types.Float64Source, window int, args ...int) *PivotLowStream {
rightWindow := window
if len(args) > 0 {
rightWindow = args[0]
}
s := &PivotLowStream{ s := &PivotLowStream{
Float64Series: types.NewFloat64Series(), Float64Series: types.NewFloat64Series(),
window: window, window: window,