The OBOnlyV3 strategy is designed to backtest trading strategies. Here is a short description of what the strategy does:
The strategy has three main functions: populate_indicators, populate_buy_trend, and populate_sell_trend. In the populate_indicators function, the strategy computes certain indicators based on the provided dataframe.
It checks the last computed indicators' time and if it's different from the current dataframe's time, it sets a flag called "compute" to True.
If the flag is True and the strategy uses protections, it calculates the ratio based on some trade data and updates a dictionary called "cust_conditions" for a specific trading pair.
Additionally, it calculates the delta value based on the highest and lowest prices in the dataframe and sets the "cust_conditions" flag to True if the delta is less than 0.06. The function returns the modified dataframe. The populate_buy_trend function takes the modified dataframe and metadata as input. It retrieves the "cust_conditions" flag for the given trading pair. If the conditions are met and a random number generator returns 0 based on the performance weight of the pair, it sets the "buy" column of the dataframe to 1. Otherwise, it sets it to 0. The modified dataframe is returned. The populate_sell_trend function sets the "sell" column of the dataframe to 0 for all rows. The unchanged dataframe is returned. Overall, the strategy calculates indicators, checks conditions, and sets the "buy" column of the dataframe based on those conditions. The "sell" column is always set to 0.