[fix] place price
This commit is contained in:
parent
f976de85cc
commit
7bb439f8d3
|
@ -44,7 +44,7 @@ exchangeStrategies:
|
|||
longCCI: -150.0
|
||||
shortCCI: 150.0
|
||||
leverage: 5.0
|
||||
profitRange: 0.25%
|
||||
profitRange: 2%
|
||||
lossRange: 1%
|
||||
amount: 20
|
||||
# recalculate: false
|
||||
|
|
|
@ -151,10 +151,10 @@ func (s *Strategy) generateOrders(ctx context.Context, kline types.KLine) ([]typ
|
|||
//midPrice := (kline.High.Add(kline.Low)).Div(fixedpoint.Value(2.0))
|
||||
//midP := (kline.High + kline.Low) / 2
|
||||
if s.TradeType[symbol] == "long" {
|
||||
placePrice = kline.Low
|
||||
placePrice = kline.High
|
||||
//placePrice = midP
|
||||
} else if s.TradeType[symbol] == "short" {
|
||||
placePrice = kline.High
|
||||
placePrice = kline.Low
|
||||
//placePrice = midP
|
||||
} else {
|
||||
return orders, nil
|
||||
|
@ -361,12 +361,12 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor qbtrade.OrderExecutor,
|
|||
|
||||
if !s.Traded[symbol] {
|
||||
// 如若在下一根k线未成交 则取消订单
|
||||
if s.TradeType[symbol] != "" && s.TradeRetry[symbol] > 10 {
|
||||
if s.TradeType[symbol] != "" && s.TradeRetry[symbol] > 1 {
|
||||
qbtrade.Notify(fmt.Sprintf("交易信号未成交,取消订单: %s", symbol))
|
||||
s.cancelOrders(ctx, symbol)
|
||||
}
|
||||
|
||||
if s.TradeType[symbol] != "" && s.TradeRetry[symbol] <= 10 {
|
||||
if s.TradeType[symbol] != "" && s.TradeRetry[symbol] <= 1 {
|
||||
s.TradeRetry[symbol] = s.TradeRetry[symbol] + 1
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user