The MACDEMA200 strategy is a trading strategy that combines the Moving Average Convergence Divergence (MACD) and the Exponential Moving Average (EMA) indicators. Here is a breakdown of what the strategy does:
It calculates the MACD values and adds them to the dataframe. It calculates the MACD signal values and adds them to the dataframe.
It calculates the 200-period EMA values and adds them to the dataframe.
It creates a custom "buy" column based on certain conditions: when the MACD crosses above the MACD signal, the MACD is negative, and the closing price is above the EMA200.
It sets a custom stop loss value by taking the minimum of the previous 5 lows. It sets a custom target price by adding 1.5 times the difference between the closing price and the custom stop loss value to the closing price. It creates a custom "sell" column based on certain conditions: when the MACD crosses below the MACD signal, the MACD is positive, and the closing price is below the EMA200. If the closing price is higher than the custom target price, it marks a "sell" signal. If the closing price is lower than the custom stop loss value, it marks a "sell" signal. The strategy uses these custom "buy" and "sell" columns to determine the buying and selling signals in the populate_buy_trend and populate_sell_trend functions, respectively.
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/Discord_MACDEMA200.py", line 36, in populate_indicators
if (
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/generic.py", line 1519, in __nonzero__
raise ValueError(
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().