The TaSearchDynamic5m strategy is designed for backtesting trading strategies on 5-minute candlestick data. Here is a brief description of what the strategy does:
The strategy uses the TaSearchDynamic module for searching and analyzing price extremes. The strategy sets a parameter n to 108, which is used in the TaSearchDynamic module.
The strategy defines a minimal_roi (minimum return on investment) dictionary with two key-value pairs: at time 0, the minimum ROI is 0.05 (5%), and at time 360, the minimum ROI is 0.02 (2%).
The strategy sets a stop loss at -0.02 (-2%).
The timeframe for the strategy is set to 5 minutes. The strategy initializes by creating an instance of the TaSearchDynamic class with the specified n value. The populate_indicators function is responsible for populating indicators in the DataFrame df. It renames the columns, checks for zero volume, finds price extremes using the TaSearchDynamic module, and applies several buying conditions. The buy_minimum function checks if the minimum closing price in the last 600 candles (tails of the DataFrame) is lower than the last closing price. If it is, the buy_min column in the DataFrame is set to 1. The buy_past_rsi function iterates over the last 200 rows of the DataFrame, calculates a percentage value using the TaSearchDynamic module, and checks if the percentage value meets certain conditions. If the conditions are met, candles are counted and assigned to the buy_past_rsi column. The buy_stride function iterates over the last 100 rows of the DataFrame and applies several conditions to determine when to buy. It checks the RSI value, compares it with other RSI values, and checks for negative percentage values. It counts the number of candles and assigns it to the buy_stride column. The populate_buy_trend function populates the buy column based on specific conditions involving the buy_stride and buy_past_rsi columns. The populate_sell_trend function populates the sell column based on specific conditions involving the RSI values. The confirm_trade_exit function determines whether to exit a trade based on the exit reason and profit ratio. If the exit reason is 'exit_signal' and the profit ratio is negative, the function returns False to prevent the trade from being exited. Please note that this description provides an overview of the strategy's functionality, but further details may be present in the modules and functions referenced within the strategy.