GOLD EA "転流" began with only two horizontal lines
I have been trading FX for over 10 years. One of the things I have emphasized in discretionary trading is level lines where price reacts.
I wondered whether I could reproduce this level-line-based trading as automated trading logic. With that thought, I started development of the GOLD-specific EA “TENRYU - Tenryu -.”
TENRYU now incorporates various conditions and risk management features, but the original logic was astonishingly simple.
Initially, only the high and low level lines
Development began in early September 2026.
The first file wasEA_v0_1_HorizontalReversal.mq5named.
What I was trying to do wasn’t difficult.
On the chart, I would find the most recent confirmed high and low, and draw horizontal lines at each.
Treat the high-side line as resistance and the low-side as support, and enter on a counter-trend when the price reached those lines.
- SELL when the resistance is reached
- BUY when the support is reached
Basically, that was all there was to it.
The horizontal lines were a concept I had used in discretionary trading as well.
So from the start I focused on automating familiar trading rather than combining complicated indicators.
The entry conditions were also quite simple
In the initial EA, I used the concept of Pivot to mechanically determine the recent highs and lows.
In comparison to surrounding candles, I selected points where a high higher than nearby highs or a low lower than nearby lows was confirmed as horizontal lines.
In the original settings, I used 10 candles before and after for the determination.
Entries occurred at the moment the price reached and crossed that horizontal line.
At this stage, there were no subsequent fine-grained trend-direction checks or roll reversals (role reversal of supports and resistances).
Anyway, when the price hits the horizontal line, I aimed for a reversal.
That was the goal of the early logic.
Take profit fixed at 3 dollars per GOLD price
The take-profit width was also fixed.
If buying, set TP 3 dollars above the entry price; if selling, 3 dollars below.
Lot size was 0.01 lot.
The same horizontal line entry was limited to a maximum of three times.
The 3 dollars refers to the price width of GOLD itself. Actual profit or loss depends on lot size and trading conditions.
It wasn’t designed to aim for large moves from the start, but to capture relatively small rebounds at horizontal lines.
Looking back now, it was a rather precarious early version
Reviewing the code from that time, what concerns me most now is the lack of a stop loss.
There was also no entry restriction by trend direction.
Therefore, when the price moved in one direction without reversing at the horizontal line, there remained the problem of how to handle the position.
Of course, this v0.1 was not a finished product intended for sale, but simply an initial version to verify operation.
However, looking back from today’s completed version, I think this point was the starting point for problems I would face again in future development.
Sometimes the price would reverse after touching the horizontal line.
But there are also times when it does not reverse.
In discretionary trading you can judge by watching the chart, but with an EA you cannot.
How much should that judgment be built into conditions?
The development from here on was a process of repeated considerations like that.
When you build it, you find there are many decisions beyond entry
At first I thought, if I could just have the part that “places an order when the price touches the horizontal line,” I would be done.
But when I actually built the EA, it wasn’t that simple.
If the price returns to the entered horizontal line, should I enter again?
How to prevent placing orders multiple times at the same timing?
If the horizontal line updates, how should I manage the number of past entries?
In the next version, I would fix these fine details.
In discretionary trading you don’t usually think about these operations, but when you make them into an EA you must define each rule.
Even with FX experience, EA development brought new difficulties.
From here to becoming “TENRYU”
At first the two horizontal lines for high and low expanded to four lines.
The take-profit method changed from a fixed 3 dollars to a stepped approach, and I added a trend filter, roll reversals, and losses from time passage in combination with drawdown management.
However, it was not clear from the start what the final form would be.
Create one, test it, fix problems if any.
That accumulation led to where we are now.
Capture the “tenryu” born from the horizontal line and chase the “flow” that follows.
A MT5 EA dedicated to GOLD (XAUUSD).
- Automatically detects horizontal lines and supports contact via wicks and roll reversals
- As long as the market trend continues, progressively follow profits
- Includes fixed stop loss, time-based stop loss, and entry suppression (martingale not used)
- Standard setting is 0.01 lot / range boost OFF
Net profit +1,242,820 yen / Maximum drawdown 24%
※Backtests are based on historical data and do not guarantee future profits. We recommend verifying operation on a demo account before real trading.
※This article reflects on the initial source code created in September 2026 and reviews the development at that time. The v0.1 described here is an initial version for testing, and its specifications differ from the current commercial version.