Skip to content

Commit

Permalink
strategy: fix support strategy criteria
Browse files Browse the repository at this point in the history
  • Loading branch information
andycheng123 committed Dec 19, 2021
1 parent 97f9285 commit d281182
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/strategy/support/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,19 +342,29 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
}
}

if s.longTermEMA != nil && closePriceF > s.longTermEMA.Last() {
s.Notify("%s: closed price is above the long term moving average line %f, skipping this support",
if s.longTermEMA != nil && closePriceF < s.longTermEMA.Last() {
s.Notify("%s: closed price is below the long term moving average line %f, skipping this support",
s.Symbol,
s.longTermEMA.Last(),
kline,
)
return
}

s.Notify("Found %s support: the close price %f is under EMA %f and volume %f > minimum volume %f",
if s.triggerEMA != nil && closePriceF > s.triggerEMA.Last() {
s.Notify("%s: closed price is above the trigger moving average line %f, skipping this support",
s.Symbol,
s.triggerEMA.Last(),
kline,
)
return
}

s.Notify("Found %s support: the close price %f is below trigger EMA %f and above long term EMA %f and volume %f > minimum volume %f",
s.Symbol,
closePrice.Float64(),
s.triggerEMA.Last(),
s.longTermEMA.Last(),
kline.Volume,
s.MinVolume.Float64(),
kline)
Expand Down

0 comments on commit d281182

Please sign in to comment.