kikocis/freqtrade-strategies public
Changesets · Branches · Tags · Compare
| Changeset | 0c747663ac1310c2d7871f76e3a4ad382e9954c5e0a245a10c909bcedbfb90e0 |
|---|---|
| Author | Bryan Chain <bryan.chain@cerner.com> · 2021-05-13 22:39 -04:00 |
| Committer | Bryan Chain <bryan.chain@cerner.com> · 2021-05-13 22:39 -04:00 |
| Parents | 844f22e32190 |
2 files changed
modified README.md +6 −0
| @@ -90,6 +90,12 @@ | ||
| 90 | 90 | |
| 91 | 91 | ### v5 |
| 92 | 92 | |
| 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 | + | |
| 93 | 99 | May 11, 2021 (version 5.1.3): |
| 94 | 100 | - **General** |
| 95 | 101 | - Updated `custom_sell` dataframe access to use new method. |
modified strategies/Solipsis_v5.py +12 −6
| @@ -34,7 +34,7 @@ | ||
| 34 | 34 | |
| 35 | 35 | I take no responsibility for any success or failure you have using this strategy. |
| 36 | 36 | |
| 37 | -VERSION: 5.1.3 | |
| 37 | +VERSION: 5.1.4 | |
| 38 | 38 | """ |
| 39 | 39 | |
| 40 | 40 | class Solipsis5(IStrategy): |
| @@ -301,7 +301,13 @@ | ||
| 301 | 301 | current_profit: float, **kwargs): |
| 302 | 302 | |
| 303 | 303 | 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']) | |
| 305 | 311 | |
| 306 | 312 | trade_dur = int((current_time.timestamp() - trade.open_date_utc.timestamp()) // 60) |
| 307 | 313 | max_profit = max(0, trade.calc_profit_ratio(trade.max_rate)) |
| @@ -321,13 +327,13 @@ | ||
| 321 | 327 | |
| 322 | 328 | # Determine if there is a trend |
| 323 | 329 | 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: | |
| 325 | 331 | in_trend = True |
| 326 | 332 | 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': | |
| 328 | 334 | in_trend = True |
| 329 | 335 | 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: | |
| 331 | 337 | in_trend = True |
| 332 | 338 | |
| 333 | 339 | # Don't sell if we are in a trend unless the pullback threshold is met |
| @@ -356,7 +362,7 @@ | ||
| 356 | 362 | elif current_profit < self.csell_loss_threshold.value: |
| 357 | 363 | if self.csell_bail_how.value == 'roc' or self.csell_bail_how.value == 'any': |
| 358 | 364 | # 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: | |
| 360 | 366 | return 'loss_roc' |
| 361 | 367 | if self.csell_bail_how.value == 'time' or self.csell_bail_how.value == 'any': |
| 362 | 368 | # Dynamic bailout based on time, unless time_trend is true and there is a potential reversal |