Home System Trading Post

Master Your Trades with the Hedger EA for MetaTrader 4

Attachments
10968.zip (4.71 KB, Download 2 times)

Hey there, fellow traders!

I’ve developed this EA, the Hedger, to meet my own trading needs, and I wanted to take a moment to share what it’s all about—and what it’s not.

First off, let’s get one thing straight:

  • This is NOT a magic bullet for guaranteed success! Let’s face it, losses are part of the game. I know it seems obvious, but sometimes it feels like people treat EAs as a surefire way to profit.
  • This EA doesn’t create hedges for your existing trades or on other symbols. So, while it’s about hedging, it’s not about securing an existing position. I’ll explain what the “hedge” actually does later.
  • As highlighted, this EA is primarily an Order Placement tool. It places orders based solely on your input and will cease operation once that particular trade is done.

So, what does it aim to do?

  • It lets you set your stop-loss level further away than you might usually feel comfortable with, while still trying to minimize potential losses. When you create an order, a hedge position is established within the same symbol whenever your main trade hits its “loss-zone.”
  • I used the word “tries” on purpose because this method isn’t flawless. Achieving a hedge at a “zero-loss level” can be tricky due to spreads. The EA adjusts the hedge as quickly as it can to balance the spread, but sometimes it might not work out, which could lead to a double spread loss.
  • If the hedge doesn’t trigger (due to slippage or a tight gap between entry price and trigger position), we’ve included two safety nets to prevent excessive losses:
    1. RiskSL: If there’s no active hedge, the stop-loss for the main order will automatically adjust to a pre-defined position.
    2. RiskHedge: This creates a new hedge in the loss-zone of the main trade, about three spreads away from the entry price if the standard hedge doesn’t trigger. While this allows you to maintain your original stop-loss, it may incur higher losses than usual. If it fails to create this hedge, the same principle as with RiskSL will apply.
  • Additionally, the EA incorporates a trailing system aimed at reducing losses. Just to be clear, this is about minimizing losses, not raking in profits. There’s no take-profit set for the hedge itself. Instead, the take-profit kicks in when the main order gets stopped. At that point, the EA attempts to trail the market price closely to snag a couple of extra points.
  • Another feature is its ability to close the trade if hedge losses become too significant, although this can be turned off. If k_aktivieren is set to true (meaning activate), the EA will end the trade altogether if the hedges incur losses four times. It won’t stop everything immediately but will set a take-profit for the main order at a distance of seven spreads to recoup some funds.
  • The last function is the 75-50 rule, which is off by default but can be activated through Regel_75_50. This rule measures the distance between the take-profit and entry price of the main order. When the market reaches 75% of that distance, the main order's stop-loss adjusts to 50% of that distance.

Important notes:

This EA works with OrderSelect—selecting by position! This means you can’t have any other pending orders in your terminal! Mixing things up will definitely cause issues. I may change this in the future, but time is tight right now.

Also, keep in mind that this EA isn’t fully polished and isn’t guaranteed to be bug-free. It works, but I can’t promise it’s without quirks. If you’re interested, make sure to keep an eye out for updates.

If you decide to give this tool a shot, please test it thoroughly before jumping into real trading situations. I’ve only run tests on a demo account so far, so I can’t provide real-life advice on how it’ll handle requotes or slippage.

Remember to consider the risk-reward ratio. It’s certainly possible to exit a hedge without losses, but it won’t always work out perfectly, and you should be prepared for some minor losses along the way.

Fair warning: I can’t guarantee any trading functionality!

Note: Removing the expert will close all open orders and delete pending orders!

Timeframes don’t matter too much (as mentioned), but be aware that switching timeframes during an active trade can close orders. To avoid that hassle, consider placing the EA in a separate window for analysis.

There are two EAs attached to this post: Hedger_Short for short orders and the other for long. I decided against creating a one-file version, but if there’s demand, I can look into that.

Thanks in advance for every tester, comment, and download! I hope this tool enhances your trading experience. If you have any questions, don’t hesitate to reach out. And I appreciate your understanding of my not-so-perfect English—I’m definitely not a native speaker! :)

Related Posts

Comments (0)