fix: takeProfitFactor NaN

This commit is contained in:
zenix 2022-08-08 15:16:48 +09:00
parent e34b0c6c30
commit ba532bd98c

View File

@ -405,7 +405,7 @@ func (s *Strategy) initIndicators(kline *types.KLine, priceLines *types.Queue) e
s.takeProfitFactor = &indicator.SMA{IntervalWindow: types.IntervalWindow{Interval: s.Interval, Window: s.ProfitFactorWindow}} s.takeProfitFactor = &indicator.SMA{IntervalWindow: types.IntervalWindow{Interval: s.Interval, Window: s.ProfitFactorWindow}}
s.trendLine = &indicator.EWMA{IntervalWindow: types.IntervalWindow{Interval: s.Interval, Window: s.TrendWindow}} s.trendLine = &indicator.EWMA{IntervalWindow: types.IntervalWindow{Interval: s.Interval, Window: s.TrendWindow}}
for i := 0; i < s.ProfitFactorWindow; i++ { for i := 0; i <= s.ProfitFactorWindow; i++ {
s.takeProfitFactor.Update(s.TakeProfitFactor) s.takeProfitFactor.Update(s.TakeProfitFactor)
} }
store, _ := s.Session.MarketDataStore(s.Symbol) store, _ := s.Session.MarketDataStore(s.Symbol)