diff --git a/pkg/strategy/bollmaker/strategy.go b/pkg/strategy/bollmaker/strategy.go index 71003d345..ccbdc47a8 100644 --- a/pkg/strategy/bollmaker/strategy.go +++ b/pkg/strategy/bollmaker/strategy.go @@ -83,9 +83,9 @@ type Strategy struct { MinProfitSpread fixedpoint.Value `json:"minProfitSpread"` // MinProfitActivationRate activates MinProfitSpread when position RoI higher than the specified percentage - MinProfitActivationRate fixedpoint.Value `json:"minProfitActivationRate"` + MinProfitActivationRate *fixedpoint.Value `json:"minProfitActivationRate"` - // UseTickerPrice use the ticker api to get the mid price instead of the closed kline price. + // UseTickerPrice use the ticker api to get the mid-price instead of the closed kline price. // The back-test engine is kline-based, so the ticker price api is not supported. // Turn this on if you want to do real trading. UseTickerPrice bool `json:"useTickerPrice"` @@ -336,7 +336,7 @@ func (s *Strategy) placeOrders(ctx context.Context, midPrice fixedpoint.Value, k // Apply quantity skew // CASE #1: - // WHEN: price is in the neutral bollginer band (window 1) == neutral + // WHEN: price is in the neutral bollinger band (window 1) == neutral // THEN: we don't apply skew // CASE #2: // WHEN: price is in the upper band (window 2 > price > window 1) == upTrend @@ -385,7 +385,7 @@ func (s *Strategy) placeOrders(ctx context.Context, midPrice fixedpoint.Value, k isLongPosition := s.Position.IsLong() isShortPosition := s.Position.IsShort() - if s.Position.ROI(midPrice).Compare(s.MinProfitActivationRate) >= 0 { + if s.MinProfitActivationRate == nil || (s.MinProfitActivationRate != nil && s.Position.ROI(midPrice).Compare(*s.MinProfitActivationRate) >= 0) { minProfitPrice := s.Position.AverageCost.Mul(fixedpoint.One.Add(s.MinProfitSpread)) if isShortPosition { minProfitPrice = s.Position.AverageCost.Mul(fixedpoint.One.Sub(s.MinProfitSpread))