Strategy: CustomStrategy4
Downloaded: 20230811
Stoploss: -0.1
This trading strategy, implemented in Python using the Freqtrade library, is designed to backtest a specific pattern in the financial markets. Here's a breakdown of its key components and functionality: The strategy aims to identify and trade a specific pattern: The pattern it's looking for involves the market moving in a sideways (range-bound) manner, followed by a sudden decline, then a subsequent rise forming a double top, and finally a significant drop. The strategy's main objective is to generate sell signals during this pattern.

Indicators used to identify and trade the pattern: MACD (Moving Average Convergence Divergence): Calculates MACD line, signal line, and histogram.

Bollinger Bands: Calculates upper, middle, and lower Bollinger Bands based on the closing prices.

RSI (Relative Strength Index): Computes the RSI value based on closing prices. Candlestick pattern: Identifies specific candlestick patterns (DOJI) using the TA-Lib library. Detecting sideways market conditions: The strategy defines a condition for a sideways market where the price amplitude within a specific period is relatively low (controlled by sideways_market_pct). Additionally, it considers factors like Bollinger Bands width and RSI being within a neutral range. Buy signal criteria: The strategy generates a buy signal when the market is in a sideways condition, and the MACD is positive. Sell signal criteria: The strategy produces sell signals using two conditions: It detects a double top pattern based on the identified candlestick pattern (DOJI). If the price drops below the lowest point of the most recent sideways phase. Implementation: The strategy is implemented as a class CustomStrategy4 which inherits from IStrategy provided by the Freqtrade library. The class includes methods to populate indicators, buy trends, and sell trends based on the defined conditions. Note: It seems there is a missing piece in the code where the variable sideways_low is referenced in the populate_sell_trend method but not defined anywhere in the provided code snippet. This might need to be defined elsewhere in your actual code implementation. Remember that while this description outlines the functionality and components of the strategy, proper testing, optimization, and risk management are crucial before deploying any trading strategy in a live environment.

Traceback (most recent call last): File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 3791, in get_loc return self._engine.get_loc(casted_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "index.pyx", line 152, in pandas._libs.index.IndexEngine.get_loc File "index.pyx", line 181, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'sideways_low' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/freqtrade/freqtrade/main.py", line 42, in main return_code = args['func'](args) ^^^^^^^^^^^^^^^^^^ File "/freqtrade/freqtrade/commands/optimize_commands.py", line 58, in start_backtesting backtesting.start() File "/freqtrade/freqtrade/optimize/backtesting.py", line 1401, in start min_date, max_date = self.backtest_one_strategy(strat, data, timerange) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/freqtrade/freqtrade/optimize/backtesting.py", line 1335, in backtest_one_strategy results = self.backtest( ^^^^^^^^^^^^^^ File "/freqtrade/freqtrade/optimize/backtesting.py", line 1213, in backtest data: Dict = self._get_ohlcv_as_lists(processed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/freqtrade/freqtrade/optimize/backtesting.py", line 381, in _get_ohlcv_as_lists df_analyzed = self.strategy.ft_advise_signals(pair_data, {'pair': pair}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/freqtrade/freqtrade/strategy/interface.py", line 1392, in ft_advise_signals dataframe = self.advise_exit(dataframe, metadata) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/freqtrade/freqtrade/strategy/interface.py", line 1443, in advise_exit df = self.populate_exit_trend(dataframe, metadata) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/freqtrade/freqtrade/strategy/interface.py", line 244, in populate_exit_trend return self.populate_sell_trend(dataframe, metadata) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/freqtrade/user_data/strategies/CustomStrategy4.py", line 73, in populate_sell_trend if dataframe.at[i+1, 'close'] < dataframe.at[i, 'sideways_low']: ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/indexing.py", line 2488, in __getitem__ return super().__getitem__(key) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/indexing.py", line 2440, in __getitem__ return self.obj._get_value(*key, takeable=self._takeable) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/frame.py", line 4005, in _get_value series = self._get_item_cache(col) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/frame.py", line 4414, in _get_item_cache loc = self.columns.get_loc(item) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 3798, in get_loc raise KeyError(key) from err KeyError: 'sideways_low'
stoploss: -0.1
timeframe: 1h
hash(sha256): 75fa0b4925d7add66f55b0a8aa0bf06a386b14a93abbd910645912d61613b75a
hist high sell sideways_start signal
close bb_middleband rsi macd bb_lowerband
bb_upperband low doji sideways_market

Similar Strategies: (based on used indicators)

Strategy: CustomStrategy, Similarity Score: 93.33%

last change: 2024-05-07 17:57:47