The SqueezeMomentum strategy is a trading strategy that uses Bollinger Bands (BB) and Keltner Channels (KC) to identify periods of low volatility (squeeze) and potential momentum breakout. Here is a short description of what the strategy does:
In the populate_indicators method:
Bollinger Bands (BB) are calculated using the closing prices. Upper and lower bands are computed based on the standard deviation of the closing prices.
Keltner Channels (KC) are calculated using the moving average (MA) of the closing prices and the average true range (ATR).
The squeeze condition is determined by comparing the BB and KC bands.
A value, val, is calculated using linear regression on the difference between the source (closing prices) and the average of the highest high and lowest low over a period. Color codes for plotting are determined based on the value of val. In the populate_buy_trend method:
The squeeze condition (is_sqzOn and is_sqzOff) is checked. Several conditions are evaluated to determine a buy signal, including the shift in val, ADX threshold, RSI overbought level, and volume. In the populate_sell_trend method:
Conditions are evaluated to determine a sell signal based on the shift in val, comparison with the maximum value of val, and volume. The strategy calculates various indicators such as moving averages, standard deviations, average true range, linear regression, RSI, and ADX. It then uses these indicators to generate buy and sell signals based on the squeeze condition and other criteria. Please note that this description provides an overview of the strategy, but the actual implementation may involve additional details and considerations.
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/SqueezeMomentum.py", line 399, in populate_sell_trend
dataframe.to_csv('user_data/csvs/%s_%s.csv' % (self.__class__.__name__, metadata["pair"].replace("/", "_")))
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/core/generic.py", line 3902, in to_csv
return DataFrameRenderer(formatter).to_csv(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/io/formats/format.py", line 1152, in to_csv
csv_formatter.save()
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/io/formats/csvs.py", line 247, in save
with get_handle(
^^^^^^^^^^^
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/io/common.py", line 739, in get_handle
check_parent_directory(str(handle))
File "/home/ftuser/.local/lib/python3.11/site-packages/pandas/io/common.py", line 604, in check_parent_directory
raise OSError(rf"Cannot save file into a non-existent directory: '{parent}'")
OSError: Cannot save file into a non-existent directory: 'user_data/csvs'