The MacheteV8bRallimod2 strategy is a trading strategy implemented as a class that inherits from the IStrategy class. Here is a description of what the strategy does:
The populate_indicators() method is called to populate various indicators based on the provided DataFrame and metadata. It retrieves and sets trade information for the specified trading pair.
It performs several calculations and merges the informative pair data with the main DataFrame.
Various indicators are calculated and added to the DataFrame, such as moving averages (sma_9, ma_buy), relative strength index (rsi_fast, rsi_slow, rsi), Bollinger Bands (bb_lowerband), hull moving average (hma_5), exponential moving averages (ema_25, ema_60), and others.
The ichimoku indicator is calculated using the ftt.ichimoku function, and its components (chikou_span, tenkan_sen, kijun_sen, senkou_a, senkou_b, leading_senkou_span_a, leading_senkou_span_b, cloud_green, cloud_red) are added to the DataFrame. The SSLChannels_ATR indicator is calculated, and its components (sslDown, sslUp) are added to the DataFrame. Additional calculations are performed, such as determining the future market condition (future_green), identifying high points (chikou_high), and generating buy signals (go_long) based on certain conditions. Rolling calculations are performed to determine trends (up_trend, dn_trend) based on upper and lower points. Bollinger Bands are calculated again with different parameters (bb_lowerband_neutral, bb_middleband_neutral, bb_upperband_neutral, bb_lowerband_trend, bb_middleband_trend, bb_upperband_trend). More indicators are calculated, including Average True Range (atr), Rate of Change (roc), and Relative Momentum Index (rmi). Various conditions are evaluated to generate buy signals, including offsets, Bollinger Bands and RSI conditions. The populate_buy_trend() method populates the 'buy' column of the DataFrame based on the buy signals generated in the previous step. This strategy involves using a combination of technical indicators and conditions to determine buy signals for trading.
Traceback (most recent call last):
File "index.pyx", line 598, in pandas._libs.index.DatetimeEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 2606, in pandas._libs.hashtable.Int64HashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 2630, in pandas._libs.hashtable.Int64HashTable.get_item
KeyError: 1717296060000000000
During handling of the above exception, another exception occurred:
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 566, in pandas._libs.index.DatetimeEngine.get_loc
File "index.pyx", line 600, in pandas._libs.index.DatetimeEngine.get_loc
KeyError: Timestamp('2024-06-02 02:41:00+0000', tz='UTC')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/indexes/datetimes.py", line 631, in get_loc
return Index.get_loc(self, key)
^^^^^^^^^^^^^^^^^^^^^^^^
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: Timestamp('2024-06-02 02:41:00+0000', tz='UTC')
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 1270, in backtest
open_trade_count_start = self.backtest_loop(
^^^^^^^^^^^^^^^^^^^
File "/freqtrade/freqtrade/optimize/backtesting.py", line 1175, in backtest_loop
self._check_trade_exit(trade, row, current_time) # Place exit order if necessary
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/freqtrade/freqtrade/optimize/backtesting.py", line 736, in _check_trade_exit
exits = self.strategy.should_exit(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/freqtrade/freqtrade/strategy/interface.py", line 1153, in should_exit
and self.min_roi_reached(trade=trade, current_profit=current_profit_best,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/freqtrade/user_data/strategies/Discord_MacheteV8bRallimod2.py", line 410, in min_roi_reached
_, roi = self.min_roi_reached_dynamic(trade, current_profit, current_time, trade_dur)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/freqtrade/user_data/strategies/Discord_MacheteV8bRallimod2.py", line 373, in min_roi_reached_dynamic
rmi_trend = self.custom_trade_info[trade.pair]['rmi-up-trend_inf'].loc[current_time]['rmi-up-trend_inf']
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/indexing.py", line 1153, in __getitem__
return self._getitem_axis(maybe_callable, axis=axis)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/indexing.py", line 1393, in _getitem_axis
return self._get_label(key, axis=axis)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/indexing.py", line 1343, in _get_label
return self.obj.xs(label, axis=axis)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/generic.py", line 4236, in xs
loc = index.get_loc(key)
^^^^^^^^^^^^^^^^^^
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/indexes/datetimes.py", line 633, in get_loc
raise KeyError(orig_key) from err
KeyError: datetime.datetime(2024, 6, 2, 2, 41, tzinfo=datetime.timezone.utc)