Title: Gold Trend Following Strategy: Non-Martingale Pyramiding Without Pending Orders
This article presents a mature gold (XAU/USD) trading logic that uses direct market entries (no pending orders), pyramiding in the trend direction, and zero martingale. It is specifically designed to survive ranging markets through an adaptive filter.
1. Core Philosophy: Trend Continuation with Network Pyramiding
Unlike martingale which adds against the trend (doubling down on losers), this system adds *with* the trend. Each new position is smaller than the previous one (reverse pyramiding), keeping average entry favorable . This approach aligns with the principle that gold tends to move in stair-step patterns: sharp trends followed by consolidation, then another leg up .
2. Entry Logic: Direct Market on Candle Close
*No pending orders are used.* The EA evaluates at the open of a new H1 candle using only closed bar data to eliminate repainting .
Entry Rules for Long:
Action: At the next candle open, execute a market buy order with fixed lot = 0.5% of account equity.
3. Pyramiding Rules (Network-Style Layering)
Maximum 3 layers per direction. Each layer has a larger stop distance but smaller position size.
| Layer | Entry Trigger | Position Size (% of equity) | Initial Stop Loss |
|-------|---------------|------------------------------|-------------------|
| 1 | Initial signal | 0.5% | 1.5 x ATR(14) |
| 2 | Price > previous high + 0.5x ATR | 0.3% | 2.0 x ATR(14) |
| 3 | Price > layer-2 high + 0.5x ATR | 0.2% | 2.5 x ATR(14) |
*Crucially, never add a layer if floating drawdown exceeds 3% of equity.*
4. Range Market Compatibility - The Exit Filter
Gold spends more time ranging than trending . The system detects ranging conditions using the ADX indicator:
5. Exit Rules
Take Profit: Cumulative risk-to-reward ratio of 1:3 from the first layer's entry price.
Trailing Stop: Once total floating profit reaches 2% of equity, move stop loss on all layers to the entry price of layer 2 (ensures overall profit lock).
Hard Stop: Maximum total risk per trading day is 2% of equity. If two consecutive losing trades occur, stop trading for 24 hours .
6. Pseudo-Code for EA Implementation
```python
# Gold Trend Following with Pyramiding (Non-Martingale)
if new_candle_open and not in_cooldown:
if adx(14) > 25 and close[1] > ema(20)[1]:
if position_count == 0:
market_buy(lot=0.005 * equity)
elif position_count == 1 and high[1] > entry_price_1 + 0.5 * atr(14):
market_buy(lot=0.003 * equity)
elif position_count == 2 and high[1] > entry_price_2 + 0.5 * atr(14):
market_buy(lot=0.002 * equity)
if adx(14) < 20:
close_all_positions()
if total_floating_profit > 0.02 * equity:
move_sl_to_breakeven_for_all()
```
7. Backtest Expectations (Based on similar H1 Gold EAs)
A 2-year backtest on H1 gold with variable spreads (2024-2026) might yield :
8. Risk Management Rules
Reference: