The ClucHAnix strategy is a trading strategy that uses various indicators to determine buy and sell signals. Here is a breakdown of what the strategy does:
populate_indicators function:
Calculates Heikin Ashi candles based on the provided dataframe. Adds Heikin Ashi open, close, high, and low prices to the dataframe.
Calculates Bollinger Bands using the Heikin Ashi typical price, with a window size of 40 and 2 standard deviations.
Adds lower and middle Bollinger Bands to the dataframe.
Calculates the absolute difference between the middle Bollinger Band and the lower Bollinger Band and stores it as 'bbdelta'. Calculates the absolute difference between the current and previous Heikin Ashi close prices and stores it as 'closedelta'. Calculates the absolute difference between the Heikin Ashi close price and the Heikin Ashi low price and stores it as 'tail'. Adds the lower Bollinger Band and middle Bollinger Band to the dataframe. Calculates the exponential moving averages (EMAs) of the Heikin Ashi close price with time periods of 3 and 50. Calculates the slow moving average of the volume using a window of 30. Calculates the Rate of Change Ratio (ROCR) of the Heikin Ashi close price with a time period of 28. Calculates the Relative Strength Index (RSI) using the Heikin Ashi close price. Adjusts the RSI value to the Fisher Transform. Retrieves an informative dataframe for a different timeframe ('1h') and merges it with the current dataframe. populate_buy_trend function:
Retrieves the buy parameters for the strategy. Uses conditions to determine buy signals based on the following criteria:
The 1-hour ROCR value is greater than the specified 'rocr-1h' parameter. Various conditions related to Bollinger Bands, such as the lower Bollinger Band being positive, the 'bbdelta' being greater than the product of the Heikin Ashi close price and the 'bbdelta-close' parameter, the 'closedelta' being greater than the product of the Heikin Ashi close price and the 'closedelta-close' parameter, and the 'tail' being less than the product of the 'bbdelta' and the 'bbdelta-tail' parameter. The Heikin Ashi close price is less than the previous lower Bollinger Band and less than or equal to the previous Heikin Ashi close price. The Heikin Ashi close price is less than both the slow EMA and the product of the 'close-bblower' parameter and the lower Bollinger Band. Sets the 'buy' column of the dataframe to 1 for the identified buy signals. populate_sell_trend function:
Retrieves the sell parameters for the strategy. Uses conditions to determine sell signals based on the following criteria:
The Fisher Transform value is greater than the specified 'sell-fisher' parameter. Conditions related to the Heikin Ashi candles and moving averages, such as the Heikin Ashi high prices being less than or equal to the previous two Heikin Ashi high prices, the Heikin Ashi close price being less than or equal to the previous Heikin Ashi close price, the fast EMA being greater than the Heikin Ashi close price, and the product of the Heikin Ashi close price and the 'sell-bbmiddle-close' parameter being greater than the middle Bollinger Band. The volume is greater than 0. Sets the 'sell' column of the dataframe to 1 for the identified sell signals. The ClucHAnix_ETH class extends the ClucHAnix strategy and likely contains additional logic specific to Ethereum (ETH) trading.