How to write a Moving Average Cross EA using the EA framework.
This is in answer to a subscriber question on how to write a moving average cross EA for MT5. It is also a good example for first use of the EA framework developed in parts 1-3 of this series.
To write the EA I have created 2 new child classes, CIndicatorMA inheriting from CIndicatorBase and CSignalCrossover inheriting from CSignalBase. The EA template can then be easily used to combine these to form a moving average crossover expert.
I have also introduced a small modification to the CSignalBase class to add a function that will be commonly used to retrieve technical indicator data and there are updates to the include files to introduce the new indicator and signal classes.
If you have not seen the earlier parts where the framework is developed the links below will take you to those articles.
Part 1 built the EA template and the expert class which take care of managing the expert.
Part 2 added trade signals.
Part 3 completes the framework ready for use.
The latest version framework including base classes is available for download.
The framework only includes the base classes and folder structure. It is intended as a basis to follow the tutorial video. To use the framework and folow the video you will need to:
- Create the SignalCrossover file
- Create the IndicatorMA file
- Modify the AllIndicators file to include IndicatorMA
- Modify the AllSignals file to include SignalCrossover
- Use the EA template to create the MA Crossover EA
This is the Expert Advisor framework used in the MQL By Request series. The framework includes base classes and include files but does not include specific child classes created as…