The MinMaxF strategy is a trading strategy that uses the argrelextrema function from SciPy to identify local minima and maxima in the price data. It operates on 5-minute timeframe data. Here's a breakdown of how the strategy works:
The strategy starts by defining a minimal return on investment (ROI) of 10% and a stop loss of -5%.
The populate_indicators function is responsible for populating the indicators used by the strategy.
It calculates the local minima and maxima using the argrelextrema function on separate slices of the price data.
For each slice of the data, if the penultimate candle is identified as a local minimum, a buy signal is generated and marked in the buy_signal column of the dataframe. Similarly, if the penultimate candle is identified as a local maximum, a sell signal is generated and marked in the sell_signal column of the dataframe. The commented-out section in the code is an alternative approach that uses argrelextrema on the entire price data without separating it into slices. However, this approach is considered to have lookahead bias and is not used in the strategy. The populate_buy_trend function populates the buy column of the dataframe with a value of 1 for rows where a buy signal is present. The populate_sell_trend function populates the sell column of the dataframe with a value of 1 for rows where a sell signal is present. In summary, the MinMaxF strategy identifies local minima and maxima in the price data to generate buy and sell signals.