Skip to content

Commit 0a6c41c

Browse files
committed
fix/bollmaker: fix s.MinProfitActivationRate condition
1 parent ca48904 commit 0a6c41c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/strategy/bollmaker/strategy.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ type Strategy struct {
8585
// MinProfitActivationRate activates MinProfitSpread when position RoI higher than the specified percentage
8686
MinProfitActivationRate *fixedpoint.Value `json:"minProfitActivationRate"`
8787

88-
// UseTickerPrice use the ticker api to get the mid price instead of the closed kline price.
88+
// UseTickerPrice use the ticker api to get the mid-price instead of the closed kline price.
8989
// The back-test engine is kline-based, so the ticker price api is not supported.
9090
// Turn this on if you want to do real trading.
9191
UseTickerPrice bool `json:"useTickerPrice"`
@@ -336,7 +336,7 @@ func (s *Strategy) placeOrders(ctx context.Context, midPrice fixedpoint.Value, k
336336

337337
// Apply quantity skew
338338
// CASE #1:
339-
// WHEN: price is in the neutral bollginer band (window 1) == neutral
339+
// WHEN: price is in the neutral bollinger band (window 1) == neutral
340340
// THEN: we don't apply skew
341341
// CASE #2:
342342
// 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
385385
isLongPosition := s.Position.IsLong()
386386
isShortPosition := s.Position.IsShort()
387387

388-
if s.MinProfitActivationRate == nil || s.Position.ROI(midPrice).Compare(*s.MinProfitActivationRate) >= 0 {
388+
if s.MinProfitActivationRate == nil || (s.MinProfitActivationRate != nil && s.Position.ROI(midPrice).Compare(*s.MinProfitActivationRate) >= 0) {
389389
minProfitPrice := s.Position.AverageCost.Mul(fixedpoint.One.Add(s.MinProfitSpread))
390390
if isShortPosition {
391391
minProfitPrice = s.Position.AverageCost.Mul(fixedpoint.One.Sub(s.MinProfitSpread))

0 commit comments

Comments
 (0)