The Solipsis strategy is a trading strategy implemented as a class that inherits from the IStrategy interface. Here's a short description of what the strategy does:
The populate_indicators method is responsible for calculating and populating various indicators in the input dataframe. These indicators include:
'rmi-slow': The slow Relative Momentum Index (RMI) with a length of 21 and a momentum of 5.
'rmi-fast': The fast RMI with a length of 8 and a momentum of 4.
'roc': The Rate of Change indicator with a time period of 6.
'mp': The RSI indicator applied to the 'roc' indicator with a time period of 6. 'rmi-up': A binary indicator that is 1 if the 'rmi-slow' value is greater than or equal to its previous value, 0 otherwise. 'rmi-dn': A binary indicator that is 1 if the 'rmi-slow' value is less than or equal to its previous value, 0 otherwise. 'rmi-up-trend': A binary indicator that is 1 if the rolling sum of 'rmi-up' over the last 3 periods is greater than or equal to 2, 0 otherwise. 'rmi-dn-trend': A binary indicator that is 1 if the rolling sum of 'rmi-dn' over the last 3 periods is greater than or equal to 2, 0 otherwise. 'rmi-max': The maximum value of 'rmi-slow' over a rolling window of 10 periods. 'fib-ret': The Fibonacci retracement indicator. 'pmax-trend': A trend indicator calculated using the PMAX function if the 'base-pmax-enable' parameter is set to True; otherwise, it is set to False. The populate_indicators method also includes additional calculations and dataframe manipulations based on the 'buy_params' and 'sell_params' obtained from the 'metadata' dictionary. The populate_buy_trend method is responsible for generating buy signals in the dataframe based on specific conditions. The conditions are defined based on the strategy's parameters and indicators calculated in the populate_indicators method. The conditions include checks on profit factors, RMI growth, trend directions, RSI values, Fibonacci levels, and additional conditions related to stake currency. If any of the conditions are met, the 'buy' column in the dataframe is set to 1 to indicate a buy signal. Overall, the Solipsis strategy utilizes various indicators and conditions to generate buy signals for backtesting trading strategies.