In this recipe, you continue coding the StrategyEMARegularOrder class. Here, you code the strategy_select_instruments_for_entry() method, a mandatory method enforced by the StrategyBase base class. This method is called by the AlgoBulls core engine on every new candle for backtesting, paper trading, and real trading services.
Please refer to the flowchart in the introduction of this chapter to understand how the AlgoBulls core engine calls the strategy_select_instruments_for_entry() method during strategy execution.
Getting ready
Make sure you have followed the preceding recipe to create the StrategyEMARegularOrder class before starting this recipe.
How to do it…
Continue coding the StrategyEMARegularOrder class. We need to define two new methods—a method for getting the crossover value between the MACD line and MACD history signals and a method for selecting instruments from instruments_bucket...