55 MA - MetaTrader 5 Expert | Forex Indicators Download - MT4/MT5 Resources - MetaTrader 5 Resources

Idea comes from : Costly_
MQL5 code author : Balabashka Kong
The iMA (Moving Average, MA) indicator in this Expert Advisor allows changing the time range ( MA: Time Frame ), horizontal shifts ( MA: Horizontal Movement ), averaging ( MA: Smooth Type ) and applied price ( MA: Price Type ) - that is, all parameters except the averaging period. The average period is provided in the code and is equal to 55 (this number is used in the name of the EA).
The EA only runs during the formation of new bars. Once the current time (only hours, no minutes and seconds) enters the interval start time to end time , the Expert Advisor requests data from the indicator. It requests data not only from bar #0 and #1, but also from bar number #A and bar number #B .
The values on these two bars are then compared: if the difference between them is greater than or equal to the difference between bars #A and #B - a signal to open a position will be generated. This reversing signal has the feature disabled by default (set to false ) and the following rules apply to the signal:
Buy signal: MA( bar number #A ) > MA( bar number #B ) + difference between bars #A and #B ;
Sell signal: MA( bar number #A ) < MA( bar number #B ) - the difference between bars #A and #B .
If you enable closing of opposite positions (set Close Opposite Positions to true ), sell positions will be closed on the final buy signal and vice versa.
The position can be fixed - in which case it consists of a lot or calculated based on risk parameters ( a lot in which case must equal zero).
You should optimize your EA separately for each symbol and time frame. Since the EA only performs operations at the time of new bar formation, it is possible to perform genetic optimization in the "1 minute OHLC" quote generation mode.
The graph shows the approximate parameter limits for the time range from M15 to H1:

Attachment download
📎 55_ma.mq5 (40.29 KB)
Source: MQL5 #21743
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •