exit/protectivestoploss: works in long position

This commit is contained in:
Andy Cheng 2022-08-08 16:49:19 +08:00
parent 1cd48177ae
commit b133767e47

View File

@ -119,8 +119,10 @@ func (s *ProtectiveStopLoss) Bind(session *ExchangeSession, orderExecutor *Gener
}
isPositionOpened := !position.IsClosed() && !position.IsDust(kline.Close)
if isPositionOpened && position.IsShort() {
if isPositionOpened {
s.handleChange(context.Background(), position, kline.Close, s.orderExecutor)
} else {
s.stopLossPrice = fixedpoint.Zero
}
})