supertrend: avoid using embedded struct on DoubleDema

This commit is contained in:
c9s 2022-07-08 17:13:12 +08:00
parent 5bd292d0b2
commit 59fcef0b6d
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -42,7 +42,7 @@ type Strategy struct {
types.IntervalWindow
// Double DEMA
DoubleDema
DoubleDema *DoubleDema
// SuperTrend indicator
@ -165,7 +165,7 @@ func (s *Strategy) setupIndicators() {
kLineStore, _ := s.session.MarketDataStore(s.Symbol)
// Double DEMA
s.setupDoubleDema(kLineStore, s.Interval)
s.DoubleDema.setupDoubleDema(kLineStore, s.Interval)
// Supertrend
if s.SupertrendWindow == 0 {
@ -342,7 +342,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
stSignal := s.Supertrend.GetSignal()
// DEMA signal
demaSignal := s.getDemaSignal(openPrice64, closePrice64)
demaSignal := s.DoubleDema.getDemaSignal(openPrice64, closePrice64)
// Linear Regression signal
var lgSignal types.Direction