This recipe demonstrates the initial coding of the StrategyEMARegularOrder class. The complete class will be coded by the end of the EMA-Regular-Order strategy – coding the strategy_exit_position method recipe of this chapter. In this recipe, you will code the following methods:
- __init__()
- initialize()
- name()
- versions_supported()
To learn more about the EMA technical indicator, please refer to the Trend indicator – exponential moving average recipe of Chapter 5, Computing and Plotting Technical Indicators.
Please refer to the flowchart in the introduction of this chapter to understand how the AlgoBulls core engine calls the __init__() and initialize() methods during strategy execution.
Getting ready
Make sure you have the StrategyBase and pyalgotrading constants in your Python namespace. Refer to the Technical requirements section of this chapter to set it up.