Discussing the article: "Introduction to MQL5 (Part 26): Building an EA Using Support and Resistance Zones"

 

Check out the new article: Introduction to MQL5 (Part 26): Building an EA Using Support and Resistance Zones.

This article teaches you how to build an MQL5 Expert Advisor that automatically detects support and resistance zones and executes trades based on them. You’ll learn how to program your EA to identify these key market levels, monitor price reactions, and make trading decisions without manual intervention.

In this project, we are creating an EA that automatically searches for support and resistance zones within a specified number of bars. Instead of relying on manually drawn zones, the EA will analyze recent price movements to detect areas where the market has repeatedly reacted, either by bouncing upward (support) or reversing downward (resistance).

Support

To find every swing low, the EA first loops through the specified number of bars. A swing low is a candle that indicates a brief bottom in price action when its low price is lower than the candles that come right before and after it.

After identifying a swing low, the EA discovers the minimal value between the candle's open and close prices as well as the precise low price of the candle that created it. The possible support zone is defined by these two values, although this has not been verified yet. After this swing low, the EA checks ahead in time to see if another swing low has formed in the same zone. The minimum between the open and close of the candle that generated the first swing low must be greater than the second swing low. This recurrence suggests that the market has once more examined the region, enhancing its importance.

After identifying this support zone, the EA confirms that no candle has broken below it. The zone is deemed illegitimate and not considered if any candle closes below it. The EA moves to a lower timeframe to keep an eye out for a bullish change of character when the zone has held steady. A buy trade is initiated when such a change in structure is identified, indicating that the market is being taken over by buyers and that the support zone has stayed firm.

Figure 1. Support

Author: Israel Pelumi Abioye