Is Hedging the Key to a Robust Expert Advisor? - page 2

 
Michael Charles Schefe #:
[T]hen i suggest that you search google.
I did worse than that. I consulted the MQL5 Lite AI Assistant, and it coded me a direct hedging EA that proved to be an utter disaster in the Tester.😅
 

The use of AI is now widespread worldwide because it saves a significant amount of time and effort in software development.

However, when it comes to designing an Expert Advisor for algorithmic trading, I believe AI alone is not enough. If the developer does not have a solid understanding of trading logic, risk management, and market behavior, AI can generate code, but it is unlikely to create a truly robust and profitable trading strategy.

In my opinion, the real value comes from combining the developer's experience with AI: the developer defines the trading logic, while AI accelerates and simplifies the implementation.

 
Domenico Perrotta #:

The use of AI is now widespread worldwide because it saves a significant amount of time and effort in software development.

However, when it comes to designing an Expert Advisor for algorithmic trading, I believe AI alone is not enough. If the developer does not have a solid understanding of trading logic, risk management, and market behavior, AI can generate code, but it is unlikely to create a truly robust and profitable trading strategy.

In my opinion, the real value comes from combining the developer's experience with AI: the developer defines the trading logic, while AI accelerates and simplifies the implementation.

I agree. The MQL5 Lite AI Assistant spit out is own self-generated code after I prompted a simple question about direct hedging. To be clear, I'm not in the habit of using AI to code EA's. I generally don't subscribe to direct hedging, so I let it have a go at it. That was merely an experiment.

My best EA, and best EA's in the past, have been one-and-done single position trading EA's. That is more or less by way of necessity in my FIFO jurisdiction. Even so, my algorithmic trading leaves me free time to toy with new stuff.

 

Honestly, it is an interesting concept, but too idealistic to me. I mean, if an EA has an edge, it doesn't need a hedging risk management. On the contrary, you may even lose more money than without it. Any type of risk management is a form of overfitting. Everything is overfitting. Even a stop loss is. But a stop loss or a trailing stop are still simple concepts and it's not too difficult to find the proper parameters, avoiding overfitting the strategy. With a hedging risk management, you only risk to throw good trades into the bin just because the price initially went against your initial position for a few pips (or the distance you choose). Of course, you can backtest this and find good parameters, but the risk of overfitting is quite high. I personally would never trust a hedging risk management for this reasons. I would prefer creating another EA with the idea to balance the losses of the previous one while still being profitable by itself. It is even much simpler and quicker to do.

With this, I don't mean that it's impossible. It's just a complexity that I don't find useful.

 
Daniele Fughelli #:
But a stop loss or a trailing stop are still simple concepts and it's not too difficult to find the proper parameters, avoiding overfitting the strategy.

Yes. That is so for you and I but not everyone, I suppose. If a trader's strategy doesn't have much of an edge in its logic, direct hedging could be the difference between continuing to trade versus quitting altogether.

Indirect hedging (cross-market/instrument) is a different ball of wax─wherein every trade is hedged all of the time. The best example that comes to mind at the moment is the Gold/DXY Index/U.S. 10 Year Note hedge.

 
Ryan L Johnson #:

Yes. That is so for you and I but not everyone, I suppose. If a trader's strategy doesn't have much of an edge in its logic, direct hedging could be the difference between continuing to trade versus quitting altogether.

Indirect hedging (cross-market/instrument) is a different ball of wax─wherein every trade is hedged all of the time. The best example that comes to mind at the moment is the Gold/DXY Index/U.S. 10 Year Note hedge.

In short, seeing is believing. I tried it and it seems to work, using automated systems that intervene continuously, whereas before, the same system without coverage was losing
 
Daniele Fughelli #:

Honestly, it is an interesting concept, but too idealistic to me. I mean, if an EA has an edge, it doesn't need a hedging risk management. On the contrary, you may even lose more money than without it. Any type of risk management is a form of overfitting. Everything is overfitting. Even a stop loss is. But a stop loss or a trailing stop are still simple concepts and it's not too difficult to find the proper parameters, avoiding overfitting the strategy. With a hedging risk management, you only risk to throw good trades into the bin just because the price initially went against your initial position for a few pips (or the distance you choose). Of course, you can backtest this and find good parameters, but the risk of overfitting is quite high. I personally would never trust a hedging risk management for this reasons. I would prefer creating another EA with the idea to balance the losses of the previous one while still being profitable by itself. It is even much simpler and quicker to do.

With this, I don't mean that it's impossible. It's just a complexity that I don't find useful.

Without a hedge:
The principal can reach profit more quickly;
you don't pay the spreads and commissions of hedges;
the average profit per trade can be higher;
however, the drawdown can become very high if the market continues to move up.
With a hedge:
add costs (spreads, commissions, swaps);
you can slow down the principal's profit;
in return, you reduce risk during adverse phases and can recover part of the loss through hedging cycles.
In a normal market, without a hedge, the net profit will likely be higher because you eliminate costs and don't "slow down" the principal;
in highly directional or anomalous markets, with a hedge, the average profit may be lower, but the system can survive better and contain the drawdown.
For this reason, in professional practice, many developers don't leave the hedge active all the time: they use it only when needed, for example, beyond a certain loss, a certain drawdown, or in the presence of particular volatility conditions.

So, if I were to optimize an EA, I wouldn't aim to always hedge or never hedge, but to make the hedge adaptive, so as to exploit the original logic when it's sufficient and activate the hedge only in situations where it truly adds value. This approach is more likely to maximize profit while keeping risk under control.
 
Domenico Perrotta #:
Without a hedge:
The principal can reach profit more quickly;
you don't pay the spreads and commissions of hedges;
the average profit per trade can be higher;
however, the drawdown can become very high if the market continues to move up.
With a hedge:
add costs (spreads, commissions, swaps);
you can slow down the principal's profit;
in return, you reduce risk during adverse phases and can recover part of the loss through hedging cycles.
In a normal market, without a hedge, the net profit will likely be higher because you eliminate costs and don't "slow down" the principal;
in highly directional or anomalous markets, with a hedge, the average profit may be lower, but the system can survive better and contain the drawdown.
For this reason, in professional practice, many developers don't leave the hedge active all the time: they use it only when needed, for example, beyond a certain loss, a certain drawdown, or in the presence of particular volatility conditions.

So, if I were to optimize an EA, I wouldn't aim to always hedge or never hedge, but to make the hedge adaptive, so as to exploit the original logic when it's sufficient and activate the hedge only in situations where it truly adds value. This approach is more likely to maximize profit while keeping risk under control.
i like your thinking Domenico, because i also believe for an EA to thrive in the market , one has to incorporate a form of hedgeing strategy to it, 
i will like to dive into this conversion with you and work with you because i'm currently working on a hedging strategy
 
Domenico Perrotta:

I would like to start a technical discussion about Expert Advisors for algorithmic trading.

I believe that identifying the market trend is certainly important, regardless of the approach used (price action, technical indicators, neural networks, etc.). However, I have the impression that the real determining factor in an EA's robustness is how it manages losing positions.

More specifically, I am referring to hedging systems designed to manage and recover unfavorable positions, rather than simply closing them with a stop loss.

In your opinion, can a well-designed hedging system have a greater impact on an Expert Advisor's overall performance than the entry logic itself? Or do you believe that the quality of the entry signal remains the most important factor?

From a technical perspective, this is my view:

* If an EA has no statistical edge, or a negative one, a hedging system alone cannot turn it into a profitable long-term strategy.

* On the other hand, if an EA already has a statistical edge in identifying trading opportunities, an effective hedging strategy can reduce drawdown, improve loss recovery, and produce a more stable equity curve.

* The real challenge is designing a hedging system that does not simply postpone losses by increasing market exposure, but instead takes advantage of market movements to manage and close recovery cycles efficiently.

I would be interested in hearing your technical opinions and experiences on this topic.

I think we sometimes put too much attention on finding the perfect entry and not enough on what happens after the trade is opened

You can have very good entries and still destroy a strategy with poor risk management. At the same time, I don't think great position management can magically save a strategy that has no statistical edge to begin with

If I had to put them in order, I'd probably say:

Statistical Edge > Risk Management > Position Management > Entry Precision

That's also why I don't really see this as entry logic vs. trade management. They need each other

Hedging, scaling, partial exits, pyramiding, basket management.. These are all tools. None of them are automatically good or bad. Their value depends on what they’re actually doing inside the strategy itself

With hedging specifically, I think there's an important distinction. A hedge doesn't make the risk disappear. You're changing the exposure and changing how that risk is handled

If an EA keeps opening positions simply because it refuses to accept a loss, eventually I think you're just hiding the drawdown and hoping the market gives you a way out. That's not something I'd consider robust

But if the strategy already has positive expectancy and the hedge is being used according to predefined rules to control exposure or manage an unfavorable position, then I think there's a legitimate discussion to be had

So instead of asking "Does hedging work?", the question should be:

What exactly is the hedge supposed to accomplish inside the strategy?

That's the the important thing

Personally, when I look at an EA, one of the most important questions I ask is:

"How does it behave when things goes wrong?"

Because sooner or later every strategy is going to be wrong

Making money when the market suits your system is the easy part. But what happens when the market stops cooperating tells you much more about how robust the EA actually is. Anyone can build an EA that looks brilliant when market conditions suit it. The real engineering begins when the market stops cooperating

A good entry gives you an opportunity
A statistical edge gives you expectancy
Risk management gives you longevity
Cuz that's what keeps you alive long enough to exploit it

Position management is what connects all of those things together
 
Ryan L Johnson #:

If I walked into a proprietary a trading office and told them that my strategy includes buying and selling the same instrument simulataneously, they would laugh/throw me out onto the street. "Direct hedging" is washout. Professional traders engage in cross-instrument and/or cross-market hedging─not direct hedging.

If your strategy includes trading in all "phases" of a market, the proper tactic for a ranging phase is to conditionally deploy fast price reversal entry logic.

In every type of hedging strategy, every profitable trade is reduced by a loss─with the goal of eliminating risk. That's fine for a hedge fund that has a billion dollars, but not so good for the average retail trader who has a small account.

Now I'll answer why, if someone walks into a proprietary trading firm and says, "My strategy is simply buying and selling the same instrument at the same time", they're probably not going to be taken seriously. And they’re gonna make fun of him course 😂

Because from their perspective, "that statement doesn't describe a strategy. It describes an exposure.

If I buy 1 lot of EURUSD and simultaneously sell 1 lot of EURUSD, then I haven't discovered some new source of alpha. My directional exposure is essentially neutralized, while I'm still paying trading costs

So if that is what you mean by hedging, then I completely agree with you

But still.. this is exactly where I think the terminology creates confusion, because "not all hedging serves the same purpose"

There are three very different concepts being mixed together here

1. Institutional Hedging

Banks, funds and corporations hedge constantly

An airline can hedge fuel prices. An exporter can hedge currency exposure. A financial institution can hedge FX, interest-rate, volatility or portfolio exposure

But notice the difference:

They already have an UNDERLYING EXPOSURE they want to control

The hedge isn't supposed to be the source of profit. It's there to reduce, transfer or reshape a risk that already exists

That's genuine risk management!

2. Retail Direct Hedging

This is the version that deserves much more skepticism (this is what you were talking about in your reply above)

You buy EURUSD.

It moves against you

Instead of accepting the loss, you open a sell on the same instrument

Now you've effectively reduced or locked your directional exposure, but the original loss hasn't disappeared. You've simply stopped it from changing as much while introducing additional spread, commission, swap and possibly margin costs

And this is where some retail systems create an illusion

The balance may look fine because nothing has been closed, while the equity tells a completely different story

That's not automatically sophisticated risk management

Sometimes it's simply means avoiding the realization of a loss.

3. Recovery-Based / Dynamic Hedging

Now this is where I think the original discussion becomes genuinely interesting

Suppose the hedge isn't just:

"Buy 1 lot → lose → sell 1 lot → wait"

Suppose instead the EA dynamically changes its net exposure according to volatility, market structure, correlation, position profitability or some other measurable condition

It might partially hedge rather than fully hedge. It might scale out of one side, rebalance the basket, reduce exposure during unfavorable conditions and increase it again when the statistical setup returns

At that point, I wouldn't describe the strategy simply as “buying and selling at the same time"

We're talking about an actual POSITION MANAGEMENT ALGORITHM

And this is where I think the distinction matters:

A Hedge can MANAGE an Edge

But it CANNOT create an Edge

If the original trading logic has negative expectancy, continuously manipulating the position doesn't magically change that fact. In many cases, spreads, commissions and financing costs will actually make the expectancy worse

That's why I agree with the phrase:

"A hedge is not an edge"

Where I disagree is when that gets interpreted as "professional traders don't hedge"

You're mistaken
Of course they do

They just normally hedge for a completely different reason than the retail trader who refuses to close a losing position

And this brings us straight back to the original topic

The interesting question isn't whether opening a BUY and SELL simultaneously is somehow profitable by itself. Obviously it isn't, The interesting question is: whether "intelligent position management can improve the risk adjusted performance of a strategy that already possesses a statistical edge."

Can it reduce drawdown?

Can it control exposure during abnormal market conditions?

Can it improve recovery?

Can it reduce the damage caused when the entry logic is wrong?

Can it do all of that WITHOUT introducing a hidden tail risk larger than the problem it was designed to solve?

That's the engineering problem worth discussing

Because anyone can design an EA that looks intelligent when its prediction is correct

What we should be focusing on is what the algorithm does after its prediction is wrong

That's where position management stops being decoration and starts becoming part of the strategy itself. And perhaps that's where hedging really becomes the key. Not as a replacement for the edge, but as a mechanism for protecting that edge when the market proves you wrong.