mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
strategy/supertrend: fix double dema missing interval
This commit is contained in:
parent
6c93c42ef6
commit
8aa5b706b6
|
@ -45,7 +45,9 @@ func (dd *DoubleDema) preloadDema(kLineStore *bbgo.MarketDataStore) {
|
|||
}
|
||||
|
||||
// setupDoubleDema initializes double DEMA indicators
|
||||
func (dd *DoubleDema) setupDoubleDema(kLineStore *bbgo.MarketDataStore) {
|
||||
func (dd *DoubleDema) setupDoubleDema(kLineStore *bbgo.MarketDataStore, interval types.Interval) {
|
||||
dd.Interval = interval
|
||||
|
||||
// DEMA
|
||||
if dd.FastDEMAWindow == 0 {
|
||||
dd.FastDEMAWindow = 144
|
||||
|
@ -58,5 +60,6 @@ func (dd *DoubleDema) setupDoubleDema(kLineStore *bbgo.MarketDataStore) {
|
|||
}
|
||||
dd.slowDEMA = &indicator.DEMA{IntervalWindow: types.IntervalWindow{Interval: dd.Interval, Window: dd.SlowDEMAWindow}}
|
||||
dd.slowDEMA.Bind(kLineStore)
|
||||
|
||||
dd.preloadDema(kLineStore)
|
||||
}
|
||||
|
|
|
@ -56,6 +56,9 @@ type Strategy struct {
|
|||
// Symbol is the market symbol you want to trade
|
||||
Symbol string `json:"symbol"`
|
||||
|
||||
// Double DEMA
|
||||
DoubleDema
|
||||
|
||||
// Interval is how long do you want to update your order price and quantity
|
||||
Interval types.Interval `json:"interval"`
|
||||
|
||||
|
@ -67,9 +70,6 @@ type Strategy struct {
|
|||
// SupertrendMultiplier ATR multiplier for calculation of supertrend
|
||||
SupertrendMultiplier float64 `json:"supertrendMultiplier"`
|
||||
|
||||
// Double DEMA
|
||||
DoubleDema
|
||||
|
||||
// LinearRegression Use linear regression as trend confirmation
|
||||
LinearRegression *LinGre `json:"linearRegression,omitempty"`
|
||||
|
||||
|
@ -180,7 +180,7 @@ func (s *Strategy) setupIndicators() {
|
|||
kLineStore, _ := s.session.MarketDataStore(s.Symbol)
|
||||
|
||||
// Double DEMA
|
||||
s.setupDoubleDema(kLineStore)
|
||||
s.setupDoubleDema(kLineStore, s.Interval)
|
||||
|
||||
// Supertrend
|
||||
if s.SupertrendWindow == 0 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user