strategy/supertrend: fix exit methods problem

This commit is contained in:
Andy Cheng 2022-07-25 14:11:55 +08:00
parent bfb7dd51d6
commit 07959c8862
2 changed files with 31 additions and 3 deletions

View File

@ -39,9 +39,9 @@ exchangeStrategies:
interval: 5m
# ATR window used by Supertrend
window: 49
window: 39
# ATR Multiplier for calculating super trend prices, the higher, the stronger the trends are
supertrendMultiplier: 4
supertrendMultiplier: 4.1
# leverage is the leverage of the orders
leverage: 1.0
@ -73,8 +73,34 @@ exchangeStrategies:
exits:
# roiStopLoss is the stop loss percentage of the position ROI (currently the price change)
- roiStopLoss:
percentage: 4%
percentage: 4.5%
- protectiveStopLoss:
activationRatio: 3%
stopLossRatio: 2%
placeStopOrder: false
- trailingStop:
callbackRate: 3%
#activationRatio: 20%
minProfit: 10%
interval: 1m
side: buy
closePosition: 100%
- trailingStop:
callbackRate: 3%
#activationRatio: 20%
minProfit: 10%
interval: 1m
side: sell
closePosition: 100%
- protectiveStopLoss:
activationRatio: 4%
stopLossRatio: 2%
placeStopOrder: false
- protectiveStopLoss:
activationRatio: 6%
stopLossRatio: 3%
placeStopOrder: false
- protectiveStopLoss:
activationRatio: 10%
stopLossRatio: 8%
placeStopOrder: false

View File

@ -113,6 +113,8 @@ func (s *Strategy) Validate() error {
func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {
session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: s.Interval})
session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: s.LinearRegression.Interval})
s.ExitMethods.SetAndSubscribe(session, s)
}
// Position control