The MKPmaxDcaStrategyV1_0 strategy is a trading strategy implemented in a backtesting website. Here's a short description of what the strategy does:
The strategy uses various indicators and conditions to generate buy and sell signals for trading. It populates indicators such as PMAX, RSI (Relative Strength Index), and others on the provided dataframe.
For the entry trend, it looks for specific conditions to generate a buy signal.
These conditions include the crossover of MA_1_9 and pm_10_27_9_1, MA_1_9 being greater than pm_10_27_9_1, positive volume, and/or RSI crossing above a specified buy_rsi value.
Similarly, for the exit trend, it searches for conditions to generate a sell signal. The conditions include the crossover of MA_1_9 below pm_10_27_9_1 and positive volume. The strategy includes functions for stake calculation, handling locked pairs, obtaining last and previous candles for a given pair and timeframe, determining stake amount based on filled buy orders, custom stop loss, and determining exit reasons. The strategy also includes functions for time in force, leverage calculation, and others. Please note that the provided code snippets contain commented out sections that may affect the strategy's behavior.
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: 'MA_1_9'
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 1318, in backtest_one_strategy
preprocessed = self.strategy.advise_all_indicators(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/freqtrade/freqtrade/strategy/interface.py", line 1378, in advise_all_indicators
return {pair: self.advise_indicators(pair_data.copy(), {'pair': pair}).copy()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/freqtrade/freqtrade/strategy/interface.py", line 1378, in
return {pair: self.advise_indicators(pair_data.copy(), {'pair': pair}).copy()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/freqtrade/freqtrade/strategy/interface.py", line 1410, in advise_indicators
return self.populate_indicators(dataframe, metadata)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/freqtrade/user_data/strategies/MKPmaxDcaStrategyV1_0.py", line 142, in populate_indicators
dataframe['PMAXRES'] = dataframe['MA_1_9'] / dataframe['pm_10_27_9_1']
~~~~~~~~~^^^^^^^^^^
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/frame.py", line 3893, in __getitem__
indexer = self.columns.get_loc(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: 'MA_1_9'