pivotshort: check TrendEMA pointer

This commit is contained in:
c9s 2022-07-28 11:29:27 +08:00
parent 05f6581bcd
commit 30978ecbd4
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 2 additions and 2 deletions

View File

@ -190,7 +190,7 @@ func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.Gener
} }
// trend EMA protection // trend EMA protection
if !s.TrendEMA.GradientAllowed() { if s.TrendEMA != nil && !s.TrendEMA.GradientAllowed() {
return return
} }

View File

@ -71,7 +71,7 @@ func (s *ResistanceShort) Bind(session *bbgo.ExchangeSession, orderExecutor *bbg
session.MarketDataStream.OnKLineClosed(types.KLineWith(s.Symbol, s.Interval, func(kline types.KLine) { session.MarketDataStream.OnKLineClosed(types.KLineWith(s.Symbol, s.Interval, func(kline types.KLine) {
// trend EMA protection // trend EMA protection
if !s.TrendEMA.GradientAllowed() { if s.TrendEMA != nil && !s.TrendEMA.GradientAllowed() {
return return
} }