mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
strategy: fix a bug when 'trailingStopControl' is not used
This commit is contained in:
parent
571c3834c5
commit
8b009a984a
|
@ -235,10 +235,12 @@ func (s *Strategy) LoadState() error {
|
|||
s.state.Position = types.NewPositionFromMarket(s.Market)
|
||||
}
|
||||
|
||||
if s.state.CurrentHighestPrice == nil {
|
||||
s.trailingStopControl.CurrentHighestPrice = fixedpoint.NewFromInt(0)
|
||||
if s.trailingStopControl != nil {
|
||||
if s.state.CurrentHighestPrice == nil {
|
||||
s.trailingStopControl.CurrentHighestPrice = fixedpoint.NewFromInt(0)
|
||||
}
|
||||
s.state.CurrentHighestPrice = &s.trailingStopControl.CurrentHighestPrice
|
||||
}
|
||||
s.state.CurrentHighestPrice = &s.trailingStopControl.CurrentHighestPrice
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user