Did you hit the end after breaking through the horizontal line? The "pullback after the breakout" added to GOLD EA
GOLD専用EA「転流 - TENRYU -」の development log, Episode 5.
TENRYU's initial logic aimed to reverse at horizontal lines.
SELL when price reaches a resistance.
BUY when it reaches a support.
As a contrarian using horizontal lines, this is the basic idea.
However, the market does not always reverse at horizontal lines.
It can break above resistance and rise further.
It can break below support and continue to fall.
That led to the addition to development ofRole Reversal.
Horizontal lines are not necessarily reversal points
For example, suppose GOLD rises to a certain resistance.
If contrarian, you would SELL aiming for a drop from that horizontal line.
But what if price breaks above the resistance?
That line, which previously capped upside, may now function as a support catching price from below.
This is the so-called movement where “resistance becomes support.”
Conversely, after breaking below support, that line can function as resistance.
It's a well-known idea in discretionary trading, but to use it in an EA, you must define conditions.
What constitutes a breakout?
How far does price move before you deem it broken?
When it returns, how far away from the horizontal line is acceptable to enter?
We encoded these aspects into the code.
Added Role Reversal in v0.6.20
On September 4, 2026, we addedv0.6.20to capture pullbacks after a breakout.
The concept is as follows.
First, break above resistance with the candle close.
Then price moves away upward momentarily.
And when it returns near the original resistance, consider BUY.
If it breaks below a support, the opposite applies.
From a scenario where broken support acts as resistance, consider SELL.
In the then-current settings, the confirmation width of break, the required post-break range, and the tolerance distance for pullbacks were specified in detail.
Contrarian and trend-following in the same EA
As a result, TENRYU now targets not only reversals when touching horizontal lines but also price action after the line’s role changes.
Even while using the same horizontal line, the approach differs.
Normal contrarian trading expects price to bounce from the line.
Role reversal trades on the expectation that price movement will continue in the breakout direction.
The basis on horizontal lines is common, but the entry direction can be opposite.
It was the moment when a new trading pattern was added to an initially simple EA.
Adding more logic did not mean the end
After adding role reversal, related refinements continued.
In the next version we tried changing entry limits for BUY and SELL, and later adapted to cases where the horizontal line's role changes again.
Additionally, for longer upward trends, new conditions restricting role reversal SELL were added.
In short, adding role reversal did not mean it was immediately finished.
With the new entry methods, it became necessary to investigate issues unique to that approach.
Adding a new logic does not automatically improve things
More trading patterns increase possible entry opportunities.
However, that does not guarantee higher profits.
In practice, the diagnostic data later output showed role reversal performance varied by year for both BUY and SELL.
Some years good, other years loss.
Therefore, role reversal is evaluated separately from standard reversal entries.
This was an important aspect in advancing EA development.
Rather than simply increasing logic,focus on which logic works under which conditions.
Gradually, the development focus shifted there.
Capture the “turn” born from a horizontal line and chase the ensuing “flow.”
This is a MT5 EA dedicated to GOLD (XAUUSD).
- Automatically detects horizontal lines and handles contact via wicks and role reversal
- As long as the market trend continues, progressively follow profits
- Equipped with fixed stop loss, time-based exit, and entry suppression (martingale not used)
- Standard setting is 0.01 lot / range boost OFF
Net profit +1,242,820 JPY / Maximum drawdown 24%
※Backtesting results are based on historical data and do not guarantee future profits. It is recommended to test on a demo account before live operation.
※This article is a record based on development code after September 4, 2026.