mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
pivotshort: avoid market sell again if position is already opened
This commit is contained in:
parent
629ae39095
commit
f883d42c58
|
@ -312,7 +312,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
session.MarketDataStream.OnKLine(func(kline types.KLine) {
|
||||
// TODO: handle stop loss here, faster than closed kline
|
||||
_, found := s.findHigherPivotLow(kline.Close)
|
||||
if !found && s.Entry.Immediate {
|
||||
if !found && s.Entry.Immediate && s.Position.IsDust(kline.Close) {
|
||||
s.Notify("price breaks the previous low, submitting market sell to open a short position")
|
||||
s.placeMarketSell(ctx, orderExecutor)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user