mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
pivotshort: add trendEMA and add stopEMA subscribe
This commit is contained in:
parent
7daa73917c
commit
f5f6fabe07
|
@ -29,6 +29,8 @@ type BreakLow struct {
|
||||||
StopEMARange fixedpoint.Value `json:"stopEMARange"`
|
StopEMARange fixedpoint.Value `json:"stopEMARange"`
|
||||||
StopEMA *types.IntervalWindow `json:"stopEMA"`
|
StopEMA *types.IntervalWindow `json:"stopEMA"`
|
||||||
|
|
||||||
|
TrendEMA *types.IntervalWindow `json:"trendEMA"`
|
||||||
|
|
||||||
lastLow fixedpoint.Value
|
lastLow fixedpoint.Value
|
||||||
pivot *indicator.Pivot
|
pivot *indicator.Pivot
|
||||||
stopEWMA *indicator.EWMA
|
stopEWMA *indicator.EWMA
|
||||||
|
@ -41,6 +43,14 @@ type BreakLow struct {
|
||||||
func (s *BreakLow) Subscribe(session *bbgo.ExchangeSession) {
|
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: s.Interval})
|
||||||
session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: types.Interval1m})
|
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) {
|
func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.GeneralOrderExecutor) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user