The Obelisk_Ichimoku_ZEMA_v1 strategy is an implementation of a trading strategy that utilizes the Ichimoku Cloud and Zero Lag Exponential Moving Average (ZEMA) indicators. Here is a breakdown of what the strategy does:
populate_indicators function:
It checks if the timeframe is 5 minutes. If not, an assertion error is raised.
If the timeframe is the same as the informative timeframe, it calculates slow timeframe indicators for the given dataframe and metadata.
If the timeframe is different from the informative timeframe, it requires a DataProvider (referred to as self.dp) to be specified for multiple timeframes.
It fetches the informative data for the specified pair and informative timeframe. It calculates the slow timeframe indicators for the informative data. It merges the informative data into the main dataframe, aligning the timeframes and filling missing values. It renames the columns of the merged dataframe by removing the informative timeframe suffix. It calculates fast timeframe indicators for the merged dataframe. It returns the updated dataframe. populate_buy_trend function:
It defines the ZEMA length for the buy trend as zema = 'zema_{self.zema_len_buy.value}'. It sets the 'buy' column of the dataframe to 1 for the following conditions:
When the Ichimoku Cloud is valid (dataframe['ichimoku_valid'] > 0). When the market is not bear trending (dataframe['bear_trending'] == 0). When the close price crosses above the product of the ZEMA value and a low offset (qtpylib.crossed_above(dataframe['close'], (dataframe[zema] * self.low_offset.value))). populate_sell_trend function:
It defines the ZEMA length for the sell trend as zema = 'zema_{self.zema_len_sell.value}'. It sets the 'sell' column of the dataframe to 1 when the close price crosses above the product of the ZEMA value and a high offset (qtpylib.crossed_above(dataframe['close'], (dataframe[zema] * self.high_offset.value))). should_sell function:
It determines whether the strategy should sell based on the specified sell_reason. If the sell_reason is 'roi' (return on investment), it fetches the analyzed dataframe for the pair and timeframe. It checks if the last candle of the dataframe indicates an ongoing trend (current_candle['trending'] > 0). If there is an ongoing trend, it returns False (indicating not to sell), otherwise True. plot_config dictionary:
It defines the configuration for the plot of the strategy. It specifies the colors and styles for various plot elements such as the Ichimoku Cloud, ZEMA, trend indicators, and buy/sell signals in different subplots. Overall, the strategy performs the calculation of necessary indicators, determines buy and sell signals based on conditions involving Ichimoku Cloud and ZEMA, and provides a configuration for plotting the strategy's results.