mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
strategy: re-submit trailing stop order if previous one failed
This commit is contained in:
parent
d94e8e3826
commit
ceccba43f9
|
@ -581,7 +581,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
if s.state.Position.Base.Compare(s.Market.MinQuantity) <= 0 { // Without a position
|
||||
// Update trailing orders with current high price
|
||||
s.trailingStopControl.CurrentHighestPrice = highPrice
|
||||
} else if s.trailingStopControl.CurrentHighestPrice.Compare(highPrice) < 0 { // With a position
|
||||
} else if s.trailingStopControl.CurrentHighestPrice.Compare(highPrice) < 0 || s.trailingStopControl.OrderID == 0 { // With a position or no trailing stop order yet
|
||||
// Update trailing orders with current high price if it's higher
|
||||
s.trailingStopControl.CurrentHighestPrice = highPrice
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user