How to Reduce Drawdown in XAUUSD M15 EAs? - page 2

 
I've been working on this exact problem for months on XAUUSD M15. The biggest improvement I found was combining a daily loss limit with ATR-based stop placement instead of fixed pips — gold's volatility changes too much for fixed stops to work consistently. Still refining but the drawdown reduced significantly in backtests once those two were combined.
[Deleted]  
work on h1
 
On the code side, one pattern that works well for the news-event / drawdown-pause piece is separating detection from enforcement: use OnTimer() (e.g. every 1-5 seconds) to poll AccountInfoDouble(ACCOUNT_EQUITY) against a day-start balance snapshot taken at the first tick after the daily rollover, rather than checking equity inside OnTick(). That keeps the check running even when ticks go quiet, and avoids redoing a drawdown calculation on every single tick, which is wasted work on a fast-moving pair like gold. When the daily loss threshold is breached, set a simple flag (a bool in the EA, or a GlobalVariable if other programs need to read it) that OnTick() checks before allowing any new order - existing positions can still be managed or closed by OnTick(), it's just new entries that get blocked. That "timer decides, tick executes" split keeps the logic easy to audit and avoids duplicating the same equity check across every entry condition in OnTick().
 
first you have to analyse the market from higher time frames to get the actual entries in a lower time frames
 

As everyone has said use layers of protection.

Another layer, which is quite easy to implement, is to check your best optimisation result and look at the time frames when you tend to lose money, block trading over those times. Rerun it and see what happens.

 

A lot of good layers already in this thread, so I will add one reframe and one concrete refinement rather than repeat.

Reframe: on gold M15, drawdown is less about the size of any single loss and more about losses clustering together. They bunch up in two places - regime transitions (range flipping to trend) and thin-liquidity windows around the daily rollover and pre-session. So the highest-leverage move is usually not tightening every stop, it is cutting exposure specifically in those windows. A session/time gate does more for drawdown than shaving pips off the SL, and it does it without touching the entry logic. I would build that gate structurally (fixed session hours, volatility state) rather than blocking "the hours that lost money in the backtest" - the latter, as reasonable as it sounds, is just fitting the past.

Refinement on the daily-loss-limit code Mobina described (the timer-decides / tick-executes split is the right structure): base the daily snapshot on the intraday equity high-water mark, not the day-start balance. A run to +3% that gives back to -2% passes a day-start check, but the drawdown you actually lived through was 5%. Tracking peak equity and cutting at a fixed give-back from that peak caps the felt drawdown, which is also what funded-account daily limits really measure.

One thing worth being explicit about: simply reducing lot size lowers drawdown and return by the same factor - it scales the equity curve, it does not improve it, and the Sharpe is unchanged. The only ways to lower drawdown while keeping return are selective exposure (the regime/session filter above) or de-correlation (the portfolio point raised earlier). Both are more work than turning the size knob down, but they change the shape of the curve rather than its height.

 
1.For gold trading, I believe the most important risk management techniques are proper position sizing, a maximum daily drawdown limit, and avoiding overexposure during volatile periods. 2. I prefer fixed percentage risk per trade. 3. I avoid high-volatility sessions by using time/day filters. 4. Yes, I pause trading during high-impact news events.
 
William Roeder #:

Unless you can predict the future, the only way to control drawdown is to control risk.

Just because your car can go 150 MPH doesn't mean you should. Just because you have a lot of margin, doesn't mean you should use it. Control your risk.

Risk depends on your initial stop loss, lot size, and the value of the symbol. It does not depend on margin or leverage. No SL means you have infinite risk (on leveraged symbols). Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% account total.

  1. You place the stop where it needs to be — where the reason for the trade is no longer valid. E.g. trading a support bounce, the stop goes below the support. Then you compute your lot size.

  2. AccountBalance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the spread, and DeltaPerLot is usually around $10/PIP, but it takes account of the exchange rates of the pair vs. your account currency.)

  3. Do NOT use TickValue by itself - DeltaPerLot and verify that MODE_TICKVALUE is returning a value in your deposit currency, as promised by the documentation, or whether it is returning a value in the instrument's base currency.
              MODE_TICKVALUE is not reliable on non-fx instruments with many brokers - MQL4 programming forum (2017)
              Is there an universal solution for Tick value? - Currency Pairs - General - MQL5 programming forum (2018)
              Lot value calculation off by a factor of 100 - MQL5 programming forum (2019)

  4. You must normalize lots properly and check against min and max.

  5. You must also check Free Margin to avoid stop out

  6. For MT5, see 'Money Fixed Risk' - MQL5 Code Base (2017)

Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5 or 0.1 Lots maximum.

Very Very TRUE! Thumbs up
 
I've found the best way to control both entries and exits with Gold is to incorporate bolinger bands on both the D1 and H1 timeframe on a period of 5 with a simultaneous SMA on the D1 timeframe in a period of 3. Use all the logic of both indicators to validate, it's worth the try.
 
Ebas:
Hello traders,

I have been working on algorithmic strategies for XAUUSD (M15 timeframe), and one of the biggest challenges I face is controlling drawdown while maintaining solid profitability.

In your experience:

- What risk management techniques work best for gold?
- Do you prefer fixed lot or percentage risk?
- How do you filter high-volatility sessions?
- Do you pause trading during news events?

I would appreciate hearing your thoughts and experience.

Thanks in advance.

Hey,

Just a few thoughts, no absolute certainty here:

On fixed risk vs percentage — if the stop varies from trade to trade, a fixed point risk feels a bit risky to me, but that probably depends on each person's style.

On volatility, sticking to precise time windows has always seemed simpler to me than a real-time indicator, though I'm not sure it's "the" right method.

On news, cutting trading entirely or just adjusting sizing, both can make sense depending on what you're trying to preserve.

But overall, in trading, what matters most in the end is preserving capital over the long term — might sound repetitive to say, but it's often what makes the difference between lasting or not.