pivotshort: move trendEMA log

This commit is contained in:
c9s 2022-07-30 18:02:28 +08:00
parent adb8a2a713
commit 8873101752
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -32,20 +32,19 @@ func (s *TrendEMA) GradientAllowed() bool {
s.trendGradient = s.trendEWMALast / s.trendEWMACurrent s.trendGradient = s.trendEWMALast / s.trendEWMACurrent
} }
log.Infof("trendEMA %+v current=%f last=%f gradient=%f", s, s.trendEWMACurrent, s.trendEWMALast, s.trendGradient)
if s.trendGradient == .0 { if s.trendGradient == .0 {
return false return false
} }
if s.MaxGradient > 0.0 && s.trendGradient < s.MaxGradient { if s.MaxGradient > 0.0 && s.trendGradient < s.MaxGradient {
log.Infof("trendEMA %+v current=%f last=%f gradient=%f: allowed", s, s.trendEWMACurrent, s.trendEWMALast, s.trendGradient)
return true return true
} }
if s.MinGradient > 0.0 && s.trendGradient > s.MinGradient { if s.MinGradient > 0.0 && s.trendGradient > s.MinGradient {
log.Infof("trendEMA %+v current=%f last=%f gradient=%f: allowed", s, s.trendEWMACurrent, s.trendEWMALast, s.trendGradient)
return true return true
} }
log.Infof("trendEMA %+v current=%f last=%f gradient=%f: disallowed", s, s.trendEWMACurrent, s.trendEWMALast, s.trendGradient)
return false return false
} }