In this recipe, you will continue with the coding of the StrategyEMARegularOrder class. Here, you will code the strategy_exit_position() method, the last mandatory method enforced by the StrategyBase base class. This method is called by the AlgoBulls core engine every time the strategy_select_instruments_for_exit method returns non-empty data. By the end of this recipe, you will have completed coding the StrategyEMARegularOrder class.
Please refer to the flowchart in the introduction of this chapter to understand how AlgoBulls core engine calls the strategy_select_instruments_for_exit() method during strategy execution.
Getting ready
Make sure you have followed the previous recipe before starting this recipe.
How to do it…
Continue coding the StrategyEMARegularOrder class. Define a method to the exit position for a given instrument based on sideband_info:
class StrategyEMARegularOrder(StrategyBase):
...