-
-
Notifications
You must be signed in to change notification settings - Fork 277
/
pivotshort.yaml
153 lines (123 loc) · 4.88 KB
/
pivotshort.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
---
sessions:
binance:
exchange: binance
envVarPrefix: binance
# uncomment this to enable cross margin
margin: true
# uncomment this to enable isolated margin
# isolatedMargin: true
# isolatedMarginSymbol: ETHUSDT
exchangeStrategies:
- on: binance
pivotshort:
symbol: ETHUSDT
# interval is the main pivot interval
interval: 5m
# window is the main pivot window
window: 200
quantity: 10.0
# when quantity is not given, leverage will be used.
# leverage: 10.0
# breakLow settings are used for shorting when the current price break the previous low
breakLow:
# ratio is how much the price breaks the previous low to trigger the short.
ratio: 0%
# quantity is used for submitting the sell order
# if quantity is not set, all base balance will be used for selling the short.
quantity: 10.0
# marketOrder submits the market sell order when the closed price is lower than the previous pivot low.
# by default we will use market order
marketOrder: true
# limitOrder place limit order to open the short position instead of using market order
# this is useful when your quantity or leverage is quiet large.
limitOrder: false
# limitOrderTakerRatio is the price ratio to adjust your limit order as a taker order. e.g., 0.1%
# for sell order, 0.1% ratio means your final price = price * (1 - 0.1%)
# for buy order, 0.1% ratio means your final price = price * (1 + 0.1%)
# this is only enabled when the limitOrder option set to true
limitOrderTakerRatio: 0
# bounceRatio is used for calculating the price of the limit sell order.
# it's ratio of pivot low bounce when a new pivot low is detected.
# Sometimes when the price breaks the previous low, the price might be pulled back to a higher price.
# The bounceRatio is useful for such case, however, you might also miss the chance to short at the price if there is no pull back.
# Notice: When marketOrder is set, bounceRatio will not be used.
# bounceRatio: 0.1%
# stopEMA is the price range we allow short.
# Short-allowed price range = [current price] > [EMA] * (1 - [stopEMARange])
# Higher the stopEMARange than higher the chance to open a short
stopEMA:
interval: 1h
window: 99
range: 2%
trendEMA:
interval: 1d
window: 7
resistanceShort:
enabled: true
interval: 5m
window: 80
quantity: 10.0
# minDistance is used to ignore the place that is too near to the current price
minDistance: 5%
groupDistance: 1%
# ratio is the ratio of the resistance price,
# higher the ratio, higher the sell price
# first_layer_price = resistance_price * (1 + ratio)
# second_layer_price = (resistance_price * (1 + ratio)) * (2 * layerSpread)
ratio: 1.5%
numOfLayers: 3
layerSpread: 0.4%
exits:
# (0) roiStopLoss is the stop loss percentage of the position ROI (currently the price change)
- roiStopLoss:
percentage: 0.8%
# (1) roiTakeProfit is used to force taking profit by percentage of the position ROI (currently the price change)
# force to take the profit ROI exceeded the percentage.
- roiTakeProfit:
percentage: 35%
# (2) protective stop loss -- short term
- protectiveStopLoss:
activationRatio: 0.6%
stopLossRatio: 0.1%
placeStopOrder: false
# (3) protective stop loss -- long term
- protectiveStopLoss:
activationRatio: 5%
stopLossRatio: 1%
placeStopOrder: false
# (4) lowerShadowTakeProfit is used to taking profit when the (lower shadow height / low price) > lowerShadowRatio
# you can grab a simple stats by the following SQL:
# SELECT ((close - low) / close) AS shadow_ratio FROM binance_klines WHERE symbol = 'ETHUSDT' AND `interval` = '5m' AND start_time > '2022-01-01' ORDER BY shadow_ratio DESC LIMIT 20;
- lowerShadowTakeProfit:
interval: 30m
window: 99
ratio: 3%
# (5) cumulatedVolumeTakeProfit is used to take profit when the cumulated quote volume from the klines exceeded a threshold
- cumulatedVolumeTakeProfit:
interval: 5m
window: 2
minQuoteVolume: 200_000_000
- trailingStop:
callbackRate: 3%
# activationRatio is relative to the average cost,
# when side is buy, 1% means lower 1% than the average cost.
# when side is sell, 1% means higher 1% than the average cost.
activationRatio: 40%
# minProfit uses the position ROI to calculate the profit ratio
# minProfit: 1%
interval: 1m
side: buy
closePosition: 100%
backtest:
sessions:
- binance
startTime: "2022-01-01"
endTime: "2022-06-18"
symbols:
- ETHUSDT
accounts:
binance:
balances:
ETH: 10.0
USDT: 5000.0