HedgingMartingale
- Experts
- Huseyin Furkan Ozturk
- Version: 8.90
- Updated: 27 July 2025
HedgingMartingale EA
Recommended accounts: High leverage Standard, ECN, Raw; Cent; Propfirm
This EA is a trading algorithm that combines hedging and intelligent risk management with the Martingale strategy. It is designed to provide stable performance in strong market conditions where you cannot predict trend direction. When using an appropriate set file, it can work on any instrument. Optimization results have provided successful performance on instruments such as Fx, Gold, Stock and Crypto. Instruments that tend to move sideways are its nightmare. It starts trading with a cycle. Opening the first trade that will start the cycle in the correct position can eliminate risks. Therefore, various cycle starting entry strategies have been developed and continue to be developed.
- Opens systematic positions in both buy and sell directions.
- After a loss, increases lot size following a predefined sequence.
- Minimizes losses by automatically closing positions in the opposite direction.
Example trading cycle:
0.02 SELL
0.04 BUY
0.08 SELL
0.16 BUY
0.32 SELL
...
The first trade opened starts a cycle. The rules in the set file only apply to this first trade and the first trade can only be stopped using the Freeze feature or position limit. The cycle ends when the last position closes with profit. However, if the balance is insufficient or the position limit is full, critical losses may come.
Default inputs are prepared for XAUUSD! (min deposit 6000$, leverage 500x)
If you want to get optimized set files for BTCUSD, XAUUSD and FX instruments, please send a message to the developer.
To explore my more professional paid product: VolumeHedger
EA Features
Advanced Trading Options:
- Special Take Profit for First Position:
You can increase the probability of winning by setting a lower Take Profit in the first trades. - Spread Control:
You can prevent bad order executions by setting a maximum spread limit. - Critical Spread:
If the spread widens too much during the current cycle, the EA freezes the cycle and continues trading as soon as the spread returns to normal.
Multi-Pair & Multi-EA Usage Feature:
If you want to prevent entering a new trade while there is an open position, enter the Magic Number list of EAs to be blocked (for example: 12345,65431,34123 ).
This feature is only used to prevent the first trade of the cycle. It also allows other EAs to open trades sequentially. This way, it does not negatively affect the drawdown value.
In new versions, this feature will be developed as follows; now when it enters a Buy position, it will enter trading in such a way that it will not block a Sell position in another instrument.
Also, if you do not want it to block Buy->Buy or Sell->Sell positions, it will be possible.
- Blocked Magic Numbers
Dynamic Volume Multiplier:
Our goal is to automatically increase the number of trades, not the lot size of opened trades, as your capital increases. This makes it easier to manage trades without hitting the broker's lot limit. In multi-EA environments, it is recommended to use Equity-Based mode.
- Balance-based
- Equity-based
Note: For volume calculations to be correct, match the Initial Balance parameter with your starting balance.
Position Entry Strategies:
Multiple strategy options are offered for maximum flexibility when opening the first position in a cycle. Since starting the cycle when the trend is strong will eliminate risks, strategies have been developed on this subject and tried to be presented to you as a selective list.
- Candle Direction + ATR
- ADX Indicator
Time Permissions Control:
Trend strength is different at every hour of the day; if you wish, you can restrict trading to certain days and time intervals. Enter the days you do not want to trade with numbers (for example, 1,2,3,4) 6 and 7 (Saturday, Sunday) are automatically closed. Hourly trading: Specify allowed trading hours in HH:MM–HH:MM format (for example, 03:30–21:30 or 21:30–03:00 )
Note: The EA prevents opening the first position of the cycle in the first 75 minutes of each trading day.
Gap Protection Setting:
If true, when carrying trades over the weekend, it applies a hedge trade by opening a new trade in the opposite direction of the open direction. This will prevent you from losing money with the big gap that may occur when you wake up on Monday. It removes the hedge trade on Monday at the time you specify and allows you to continue from where you left off in the cycle. If the hedge trade closes with profit and loss, it will update the tp and sl values of the original trade accordingly.
Thanks to this setting, you can safely include Friday in the weekday permissions section.
Market Rest Time Setting:
Waiting timers that prevent immediately reopening trades after volatile movements:
- After Last Trade Pending Timer:
Waits a certain number of candles (for example, 6 candles on H1 chart) after the last position closes. - After First Trade Pending Timer:
As soon as the first trade of the cycle is completed, it goes into waiting for a new cycle, delaying the cycle start.
Freeze Trading System:
As the name suggests, it is designed to freeze the cycle and restart it. When you start a cycle, if this cycle opens new trades without gaining profit, the volume size of the opened trades will increase, so it is a useful option if you want to transfer the risk to the next entry strategy. For example, if 4 trades are opened and you do not want to push your luck further, it is a feature you will love if you want to transfer to the next entry strategy.
When you make the Freeze Trades system true, the EA can perform the following:
- Temporarily stops trades and freezes the cycle.
- Restarts trades with the same lot progression when conditions are suitable.
- Trend direction options when starting the cycle: {Follow the trend, Continue in the same direction, Continue in the opposite direction}
Example: In XAUUSD trading, 4 trades were made and the lot grew, then the market holiday came and no movement is expected. If Freeze Trading is active, if a limit of 4 trades is entered it prevents opening more positions and restarts the cycle with the last lot size it left after the holiday.
Bank Holiday Protection:
During holiday periods, the buyer-seller balance is disrupted and unpredictable sideways movements may occur. If you want to prohibit opening the first position in a cycle on certain days before/after holidays, you can set how many days trading will not be done.
Example: do not enter the trading cycle 2 days before the holiday or 2 days after the holiday
- The holiday database contains USD, EUR, GBP, JPY, CAD, CHF, AUD, NZD, CNY holiday data between 2022–2025.
Dynamic Pips Adjustment:
TP and Distance values are automatically adjusted as market price changes. Ideal especially for XAUUSD. It can be useful to use when working on long-term backtests.
Since a 1% value increase or decrease of the chart from 5 years ago will not match today's points values, you can find the answer to the question of how dynamically giving input values affects the result in this feature.
- Baseline Price: Reference price point.
- Price Interval: Price change threshold (for example, 200).
- Percentage: The rate to be applied when the price changes this threshold (for example, 10%).
Example: If gold rises from $3,000 to $3,300 and Distance is 1,300 points, Percentage is 10%, Distance is automatically adjusted to 1,430 points.
Interesting information: As a result of tests, I noticed this. The gold ounce cost declared by gold businesses is around $1600. The current selling price is around $3200. The difference is $1600. When I set the price change setting to $200 and the percentage change to 13%, I realized that I found the optimum value.
Usage Recommendations
Optimize entry parameters for each instrument:
- Set Distance and Take Profit values the same or close (e.g.: 1,200 points and 900 points).
- Optimize and use the Freeze Trading feature.
- Give the market 6–12 hours rest by making the After Trade Timer feature "True".
- Set Dynamic Volume Multiplier for compound balance growth.
- Test Dynamic Pips feature for pips adjustment in long-term tests (especially for XAUUSD).
- Use Bank Holiday filter to avoid trading in bad market conditions.
- You can install this EA on multiple pairs and use the Blocked Magic list to enter trades more frequently
- Try activating the (Gap Protection) feature to avoid weekend gaps
You do not need to do ATR optimization on FX instruments; the ATR feature is temporarily disabled.
Calculate the required balance amount carefully. In future versions, the balance you need will be calculated and displayed on the chart.
About the Developer
He has completed 10 years in his software development career. As a finance and mathematics enthusiast, he has a passion for developing algorithmic-based trading robots for over 2 years. He believes that he is the architect of many algorithms and strategies he has developed and has developed them, but he was disappointed when he encountered similar algorithms in the market. Still, he continues to develop with pride in having this ability. He believes that providing the robots he develops for free instead of selling them directly will contribute more to their development. He attaches great importance to your feedback and suggestions.
If you like my robots and want to be informed about new features, join my channel: Furkan's Robots
good result so far in demo account