The FuturesStrategy1 is a trading strategy that involves backtesting various indicators and generating entry and exit signals based on those indicators. Here is a breakdown of what the strategy does:
populate_indicators method:
Calculates the Average True Range (ATR) indicator. Determines the stop-loss rates for long and short positions based on rolling minimum and maximum prices.
Stores the stop-loss rates and other information in a custom_info dictionary.
proposed_leverage method:
Customizes the leverage for each new trade based on the proposed leverage, maximum leverage, and trade side (long or short).
custom_stoploss method:
Implements a custom stop-loss mechanism using a risk/reward ratio. Retrieves the relevant information from the custom_info dictionary. Calculates the stop-loss and take-profit prices based on the initial stop-loss rate and current rate. Returns the calculated stop-loss value. populate_entry_trend method:
Populates the entry signal for the given dataframe based on several technical indicators. Conditions include the price being above the 200-day Exponential Moving Average (EMA), bullish STC (Schaff Trend Cycle), previous bearish STC, ADX (Average Directional Index) above 20, and positive volume. populate_exit_trend method:
Populates the exit signal for the given dataframe based on volume conditions. For long positions, the exit signal is triggered when the volume is zero. For short positions, the exit signal is triggered when the volume is non-zero. Overall, the strategy incorporates indicators like ATR, EMA, STC, and ADX to generate entry and exit signals based on specific conditions. The leverage, stop-loss, and take-profit are customized according to the strategy's parameters.