From 486cf50a9c23bf2aded7418d3b70732510f23675 Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 1 May 2022 01:12:57 +0800 Subject: [PATCH] bbgo: fix init band width setup --- pkg/bbgo/session.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/bbgo/session.go b/pkg/bbgo/session.go index 9a2ff2a67..e2fba67ee 100644 --- a/pkg/bbgo/session.go +++ b/pkg/bbgo/session.go @@ -84,9 +84,11 @@ func NewStandardIndicatorSet(symbol string, store *MarketDataStore) *StandardInd // setup boll indicator, we may refactor boll indicator by subscribing SMA indicator, // however, since general used BOLLINGER band use window 21, which is not in the existing SMA indicator sets. // Pull out the bandwidth configuration as the boll Key - iwTmp := types.IntervalWindow{Interval: interval, Window: 21} - iwb := types.IntervalWindowBandWidth{IntervalWindow: iwTmp, BandWidth: 1.0} - set.boll[iwb] = &indicator.BOLL{IntervalWindow: iwTmp, K: 1.0} + iw := types.IntervalWindow{Interval: interval, Window: 21} + + // set efault band width to 2.0 + iwb := types.IntervalWindowBandWidth{IntervalWindow: iw, BandWidth: 2.0} + set.boll[iwb] = &indicator.BOLL{IntervalWindow: iw, K: iwb.BandWidth} set.boll[iwb].Bind(store) }