Trying to make an EA for HOLO Strategy on XAUUSD

 

Hi!

To be honest, I am a beginner trader and a complete novice when it comes to coding. But I like new challenges and I'm curious to discover new things.

With the help of Gemini and Claude AI, I am trying to develop a trading robot that uses the HOLO strategy (“High Open, Low Open”). 

This is a mean-reversion strategy  (  return to the average ?  Sorry for traduction ), so it only works in ranging markets. Trends must be avoided.

For a buy:
We define a zone of interest between the low of the day and the upper level of the open of the last 1-hour candle. When the price opens a candle (1M, 5M, 15M, or 30M, depending on what we choose) inside this zone and then breaks above the upper boundary, we open a buy trade.

For a sell:
The zone of interest is defined between the high of the day and the lower level of the open of the highest recent 1-hour candle. When the price opens a candle inside this zone and then exits the zone to the downside, we open a sell trade.

A picture is worth a thousand words.

Explain HOLO


Naturally, the area of ​​interest evolves throughout the day, when the day's high/low is exceeded, and when a 1H candle opens higher, lower.

I will now explain what I am trying to do, and I would like advice on what is not working, because at the moment the robot is not profitable. I would like to know whether this comes from the strategy itself or from my lack of skill (I am a beginner).

From midnight, we define the day’s high and low, then we wait for the opening of the first 1-hour candle to define the initial zones.

Here is an example on TradingView, with the HOLO indicator: 

Holo in range

Red arrows shows BUY/SELL. This is the ideal situation we are looking for.
The robot places a buy/sell order as soon as the tick touches the boundary.

The stop loss can be placed in different position: either at the top/bottom of the zone, at the high/low of the candle, or at 50% of the zone. This needs to be backtested to determine what works best.

The take profit is adjustable, but a 2:1(2× SL) gives better results.

Break-even is set at 1R.

Trailing stop: optional, mainly for backtesting, but it gives worse results when enabled.

Add a trend detector, a filter that prevents trading in order to avoid consecutive stop losses. To avoid this type of situation:
Here is a second example of what we do NOT want;

Holo range

The market is trending, and we get a series of stop losses.

So my main question is: What is the best solution to avoid this type of situation?

My idea would be to add a filter that detects when the market is trending and forbids trading. Obviously, but there is many different indicator and i don't know all of them. I'm trying with ADX, and soon i will try with a Bollinger.
Do you have any other ideas?

 
Fred87K:
Do you have any other ideas?

The following indicator can be used in 2 ways. You can use it in the ranging way as described in the CodeBase:

Code Base

ATR Cycles

Ryan L Johnson, 2025.11.08 14:29

A volatility filter based on 3 ATR's: a fast ATR, a middle ATR, and a slow ATR