Summary: A complete gold trading framework using direct market orders and trend-based pyramiding. Includes entry logic, pyramiding rules, exit conditions, and range-market adaptation.




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:
  • Price closes above the 20-period EMA on H1

  • ATR(14) is above its 50-period average (volatility filter)

  • No high-impact news within 30 minutes (use a news filter)


  • 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:
  • ADX < 20: Ranging market → No new entries allowed; trail existing positions to breakeven

  • ADX > 25: Trending market → Pyramiding activated

  • ADX crosses below 20 from above: Close all positions at market


  • 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 :
  • Total trades: ~80-100 (low frequency)

  • Profit factor: 2.0 - 2.5

  • Maximum drawdown: 20-25%

  • Win rate: 40-45% (but average win is 3x average loss)


  • 8. Risk Management Rules
  • Max correlated exposure (gold + gold miners) ≤ 6% of portfolio

  • Never use grid multipliers or martingale under any condition

  • Close all positions before NFP, CPI, and FOMC


  • Reference:
  • BabyPips Forum. (2026). *New H1 Gold (XAUUSD) Algorithmic Strategy: GoldPacker v2*

  • ACY Securities. (2026). *Gold Trading Lesson 2 - Price Patterns*

  • Gate.com. (2026). *Gold CFD Trading: Traditional Finance Strategy*