From f5f6fabe079ac27ea8e2fe02217de76ccc71990c Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 13 Jul 2022 10:49:52 +0800 Subject: [PATCH] pivotshort: add trendEMA and add stopEMA subscribe --- pkg/strategy/pivotshort/breaklow.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/strategy/pivotshort/breaklow.go b/pkg/strategy/pivotshort/breaklow.go index d446a82ff..9a892022e 100644 --- a/pkg/strategy/pivotshort/breaklow.go +++ b/pkg/strategy/pivotshort/breaklow.go @@ -29,6 +29,8 @@ type BreakLow struct { StopEMARange fixedpoint.Value `json:"stopEMARange"` StopEMA *types.IntervalWindow `json:"stopEMA"` + TrendEMA *types.IntervalWindow `json:"trendEMA"` + lastLow fixedpoint.Value pivot *indicator.Pivot stopEWMA *indicator.EWMA @@ -41,6 +43,14 @@ type BreakLow struct { func (s *BreakLow) Subscribe(session *bbgo.ExchangeSession) { session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: s.Interval}) session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: types.Interval1m}) + + if s.StopEMA != nil { + session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: s.StopEMA.Interval}) + } + + if s.TrendEMA != nil { + session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: s.TrendEMA.Interval}) + } } func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.GeneralOrderExecutor) {