Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /freqtrade_freqtrade /tests /strategy /strats /hyperoptable_strategy.py
| # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement | |
| import logging | |
| from pandas import DataFrame | |
| from strategy_test_v3 import StrategyTestV3 | |
| from technical import qtpylib | |
| from freqtrade.strategy import BooleanParameter, DecimalParameter, IntParameter, RealParameter | |
| logger = logging.getLogger(__name__) | |
| class HyperoptableStrategy(StrategyTestV3): | |
| """ | |
| Default Strategy provided by freqtrade bot. | |
| Please do not modify this strategy, it's intended for internal use only. | |
| Please look at the SampleStrategy in the user_data/strategy directory | |
| or strategy repository https://github.com/freqtrade/freqtrade-strategies | |
| for samples and inspiration. | |
| """ | |
| INTERFACE_VERSION = 3 | |
| buy_params = { | |
| "buy_rsi": 35, | |
| # Intentionally not specified, so "default" is tested | |
| # 'buy_plusdi': 0.4 | |
| } | |
| sell_params = {"sell_rsi": 74, "sell_minusdi": 0.4} | |
| buy_plusdi = RealParameter(low=0, high=1, default=0.5, space="buy") | |
| sell_rsi = IntParameter(low=50, high=100, default=70, space="sell") | |
| sell_minusdi = DecimalParameter( | |
| low=0, high=1, default=0.5001, decimals=3, space="sell", load=False | |
| ) | |
| exitaaa = IntParameter(low=0, high=10, default=5, space="exitaspace") | |
| exit_rsi = IntParameter(low=0, high=10, default=5) | |
| protection_enabled = BooleanParameter(default=True) | |
| protection_cooldown_lookback = IntParameter([0, 50], default=30) | |
| # Invalid plot config ... | |
| plot_config = { | |
| "main_plot": {}, | |
| } | |
| def protections(self): | |
| prot = [] | |
| if self.protection_enabled.value: | |
| prot.append( | |
| { | |
| "method": "CooldownPeriod", | |
| "stop_duration_candles": self.protection_cooldown_lookback.value, | |
| } | |
| ) | |
| return prot | |
| bot_loop_started = False | |
| bot_started = False | |
| def bot_loop_start(self, **kwargs): | |
| self.bot_loop_started = True | |
| logger.info("Test: Bot loop started") | |
| def bot_start(self, **kwargs) -> None: | |
| self.bot_started = True | |
| self.buy_rsi = IntParameter([0, 50], default=30, space="buy") | |
| def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: | |
| dataframe.loc[ | |
| ( | |
| (dataframe["rsi"] < self.buy_rsi.value) | |
| & (dataframe["fastd"] < 35) | |
| & (dataframe["adx"] > 30) | |
| & (dataframe["plus_di"] > self.buy_plusdi.value) | |
| ) | |
| | ((dataframe["adx"] > 65) & (dataframe["plus_di"] > self.buy_plusdi.value)), | |
| "enter_long", | |
| ] = 1 | |
| return dataframe | |
| def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: | |
| dataframe.loc[ | |
| ( | |
| ( | |
| (qtpylib.crossed_above(dataframe["rsi"], self.sell_rsi.value)) | |
| | (qtpylib.crossed_above(dataframe["fastd"], 70)) | |
| ) | |
| & (dataframe["adx"] > 10) | |
| & (dataframe["minus_di"] > 0) | |
| ) | |
| | ((dataframe["adx"] > 70) & (dataframe["minus_di"] > self.sell_minusdi.value)), | |
| "exit_long", | |
| ] = 1 | |
| return dataframe | |
Xet Storage Details
- Size:
- 3.26 kB
- Xet hash:
- 4c3fb08314de23cf3f0da4cd0508abb3e572b61e9fdb87aafbb23bb5c5f7e30c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.