mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
pivotshort: market sell to open short
This commit is contained in:
parent
4bd322feb4
commit
32f324761e
|
@ -303,6 +303,11 @@ 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
|
||||
lastLow := s.getValidPivotLow(kline.Close)
|
||||
if lastLow == kline.Close && s.Entry.Immediate {
|
||||
s.Notify("price breaks the previous low, submitting market sell to open a short position")
|
||||
s.placeMarketSell(ctx, orderExecutor)
|
||||
}
|
||||
})
|
||||
|
||||
session.MarketDataStream.OnKLineClosed(func(kline types.KLine) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user