fix: takeProfitFactor NaN

This commit is contained in:
zenix 2022-08-08 15:16:48 +09:00
parent 0e3aecb549
commit 2c4e03a102

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.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)
}
store, _ := s.Session.MarketDataStore(s.Symbol)