The MiniLambo strategy is a trading strategy that aims to identify buying opportunities in the market. It utilizes various indicators such as exponential moving averages (ema), relative strength index (rsi), and percentage change in the low price. The strategy consists of three main components: populating indicators, populating buy trends, and populating sell trends.
In the populate_indicators method, the strategy calculates and adds indicators to the given dataframe.
These indicators include ema_14, rsi_4, rsi_14, rsi_21, and a percentage change in the low price.
The function returns the updated dataframe. The populate_buy_trend method determines the conditions for initiating a buy trade. It creates a boolean condition (lambo2) based on specific criteria involving the close price, ema_14, rsi_4, rsi_14, rsi_21, and the percentage change in the low price. If the conditions are met, the strategy marks the corresponding rows in the 'buy_tag' column with 'lambo2' and sets the 'buy' column to 1. The function returns the updated dataframe. The populate_sell_trend method is responsible for determining the conditions for selling a trade. In this implementation, it doesn't perform any additional calculations and simply returns the original dataframe. The execute_trade method is called when a trade is executed. It sets the sell reason for the trade, incorporating the 'buy_tag' value. It then returns True to indicate a successful execution. The MiniLambo_TBS class inherits from the MiniLambo class and extends its functionality. It overrides the populate_indicators method to add trailing buy functionality to the strategy. It calls the parent populate_indicators method and then applies trailing buy logic based on current price and previous candle data. The confirm_trade_entry method is overridden to incorporate trailing buy orders. It first calls the parent method and stores the return value. If trailing buy is enabled and the strategy is running in live or dry run mode, it further processes the trailing buy logic. It determines whether to trigger the trailing buy order based on the current price and trailing buy offset. The populate_buy_trend method in MiniLambo_TBS extends the parent method and adds trailing buy order functionality. It checks if trailing buy orders are enabled and the strategy is running in live or dry run mode. If the last candle indicates a buy signal and trailing buy order is not started, it checks for any open trades and allows trailing if no trades are currently open. It updates the 'buy_tag' column to include the initial buy tag and the start trailing price. If the trailing buy order is already started, it continues trailing for the specific pair. Overall, the MiniLambo strategy combines various indicators and trailing buy functionality to identify buying opportunities in the market.