The QBitrain strategy is a backtesting strategy that calculates indicators and determines buy and sell signals based on these indicators. Here's a breakdown of its functionality:
populate_indicators: This method calculates default values of hyperoptable parameters and is used to optimize the strategy. However, in this strategy, the specific indicators are calculated inside the populate_buy_trend and populate_sell_trend methods, if needed.
Therefore, using this method doesn't provide significant benefits other than calculating default values.
populate_buy_trend: This method populates the buy signals in the dataframe based on certain conditions and indicators.
The strategy calculates the values of multiple indicators (buy_indicator_0 to buy_indicator_5) and multiplies them with corresponding quantum states (buy_node_quantum_state_0 to buy_node_quantum_state_5). The results are accumulated in the RESULT variable, which is then normalized by multiplying it with the closing price and applying the normalize function. If the final result (RESULT) is greater than 0.333, a buy signal is generated. populate_sell_trend: This method populates the sell signals in the dataframe based on conditions and indicators. Similar to the populate_buy_trend method, the strategy calculates the values of multiple indicators (sell_indicator_0 to sell_indicator_5) and multiplies them with corresponding quantum states (sell_node_quantum_state_0 to sell_node_quantum_state_5). The results are accumulated in the RESULT variable. If the DUALFIT variable is set to True, the buy indicators and quantum states are used instead. The final result (RESULT) is normalized and if it is less than -0.333, a sell signal is generated. The strategy calculates indicators, combines them with quantum states, normalizes the results, and generates buy and sell signals based on certain thresholds.