Elffuss BraidHub

kikocis/freqtrade-strategies public

change to custom_sell, v5.1.4
Changeset0c747663ac1310c2d7871f76e3a4ad382e9954c5e0a245a10c909bcedbfb90e0
AuthorBryan Chain <bryan.chain@cerner.com> · 2021-05-13 22:39 -04:00
CommitterBryan Chain <bryan.chain@cerner.com> · 2021-05-13 22:39 -04:00
Parents844f22e32190

Browse the files at this changeset

2 files changed

modified README.md +6 −0
@@ -90,6 +90,12 @@
9090
9191 ### v5
9292
93+May 13, 2021 (version 5.1.4):
94+- **General**
95+ - It seems there is an issue with hyperopt when calling it from a child strategy. As such, it is recommended to call the strategy directly during hyperopt (e.g. --strategy Solipsis5), you can still put the found parameters into the child strategy for live/dry run if you prefer and this is still my recommended way to configure the strategy. Especially if running multiple instances.
96+- **Custom Sell**
97+ - As per issue: https://github.com/freqtrade/freqtrade/issues/4920 current_profit has not been behaving how I expected. As such I have implemented a (hopefully) temporary workaround to provide more reliable/realistic profit values during backtesting/hyperopting until an upstream solution is implemented.
98+
9399 May 11, 2021 (version 5.1.3):
94100 - **General**
95101 - Updated `custom_sell` dataframe access to use new method.
modified strategies/Solipsis_v5.py +12 −6
@@ -34,7 +34,7 @@
3434
3535 I take no responsibility for any success or failure you have using this strategy.
3636
37-VERSION: 5.1.3
37+VERSION: 5.1.4
3838 """
3939
4040 class Solipsis5(IStrategy):
@@ -301,7 +301,13 @@
301301 current_profit: float, **kwargs):
302302
303303 dataframe, _ = self.dp.get_analyzed_dataframe(pair=pair, timeframe=self.timeframe)
304- current_candle = dataframe.iloc[-1].squeeze()
304+ last_candle = dataframe.iloc[-1].squeeze()
305+
306+ # Temporary workaround because current_profit as fed to this method uses candle high
307+ # This might get changed in a future freqtrade release
308+ # See: https://github.com/freqtrade/freqtrade/issues/4920
309+ # Backtest will resolve the sale price, once triggered at the *open* of the *next* candle
310+ current_profit = trade.calc_profit_ratio(last_candle['close'])
305311
306312 trade_dur = int((current_time.timestamp() - trade.open_date_utc.timestamp()) // 60)
307313 max_profit = max(0, trade.calc_profit_ratio(trade.max_rate))
@@ -321,13 +327,13 @@
321327
322328 # Determine if there is a trend
323329 if self.csell_trend_type.value == 'rmi' or self.csell_trend_type.value == 'any':
324- if current_candle['rmi-up-trend'] == 1:
330+ if last_candle['rmi-up-trend'] == 1:
325331 in_trend = True
326332 if self.csell_trend_type.value == 'ssl' or self.csell_trend_type.value == 'any':
327- if current_candle['ssl-dir'] == 'up':
333+ if last_candle['ssl-dir'] == 'up':
328334 in_trend = True
329335 if self.csell_trend_type.value == 'candle' or self.csell_trend_type.value == 'any':
330- if current_candle['candle-up-trend'] == 1:
336+ if last_candle['candle-up-trend'] == 1:
331337 in_trend = True
332338
333339 # Don't sell if we are in a trend unless the pullback threshold is met
@@ -356,7 +362,7 @@
356362 elif current_profit < self.csell_loss_threshold.value:
357363 if self.csell_bail_how.value == 'roc' or self.csell_bail_how.value == 'any':
358364 # Dynamic bailout based on rate of change
359- if current_candle['sroc'] <= self.csell_bail_roc.value:
365+ if last_candle['sroc'] <= self.csell_bail_roc.value:
360366 return 'loss_roc'
361367 if self.csell_bail_how.value == 'time' or self.csell_bail_how.value == 'any':
362368 # Dynamic bailout based on time, unless time_trend is true and there is a potential reversal