The ClucHAnix trading strategy is implemented as a class that inherits from the IStrategy class. It involves several steps and indicators to determine buy and sell signals for backtesting purposes. Here's a breakdown of the important parts of the strategy:
populate_indicators function:
Calculates Heikin-Ashi candlestick values (open, close, high, low) based on the input dataframe.
Calculates Bollinger Bands using the Heikin-Ashi typical price, with a window size of 40 and 2 standard deviations.
Computes the absolute differences between the mid Bollinger Band and the lower Bollinger Band, the current and previous Heikin-Ashi close prices, and the Heikin-Ashi close price and low price.
Adds the calculated indicators to the dataframe, including Heikin-Ashi open, close, high, low, Bollinger Bands, exponential moving averages (EMAs), and volume mean. populate_buy_trend function:
Sets the parameters for buying based on buy_params. Generates buy signals based on specific conditions:
The 1-hour rate of change (ROCR) is greater than the defined ROCR threshold. Several conditions related to Bollinger Bands, Heikin-Ashi close prices, and trends are met. Assigns a value of 1 to the 'buy' column in the dataframe for the identified buy signals. populate_sell_trend function:
Sets the parameters for selling based on sell_params. Generates sell signals based on specific conditions:
The Fisher transformation of the relative strength index (RSI) is greater than the defined sell threshold. Conditions related to Heikin-Ashi high and close prices, EMAs, and volume are met. Assigns a value of 1 to the 'sell' column in the dataframe for the identified sell signals. The ClucHAnix_ETH class is a subclass of ClucHAnix, which indicates that it inherits the implementation of the ClucHAnix strategy and can be used specifically for Ethereum (ETH) trading. Overall, the strategy utilizes various indicators and conditions to generate buy and sell signals for backtesting trading strategies.