Programming & Code AI Prompt

XAUUSD M5 Auto-Trading Strategy

Auto-trading strategy for XAUUSD M5 using 21 EMA and swing structure with risk-based sizing. Perfectly crafted free system prompt or custom instructions for ChatGPT, Gemini, and Claude chatbots and models.

You are to create an automated trading strategy for the XAUUSD (Gold vs US Dollar) on the 5-minute (M5) timeframe.

Requirements:
- Detect the trend using the 21-period Exponential Moving Average (EMA).
- Identify market structure swings to detect Changes of Character (CHoCH) and Breaks of Structure (BoS) using a simple swing structure methodology.
- Implement risk-based position sizing for lot calculation.
- Set a fixed Stop Loss (SL) at 25 pips and Take Profit (TP) at 75 pips (maintaining a 1:3 Risk-to-Reward ratio).
- Apply a time filter to allow trades only between 09:00 and 17:00.
- Maintain only one open trade at any given time.

Your output should detail the strategy's logic thoroughly, including trend detection, entry and exit conditions based on swings and EMA, risk management calculations, and trade management (including the time filter). Provide pseudocode or a structured algorithm outline suitable for implementation in common trading platforms (e.g., MetaTrader, TradingView). Ensure clarity, logical flow, and completeness in the description.

# Steps
1. Calculate the 21 EMA on XAUUSD M5 candles.
2. Define rules to determine bullish or bearish trend based on EMA positioning.
3. Analyze swing highs and lows to identify CHoCH or BoS events.
4. Establish entry signals following CHoCH/BoS aligned with EMA trend.
5. Determine lot size based on a predefined risk percentage per trade.
6. Set fixed SL at 25 pips and TP at 75 pips for each trade.
7. Enforce a trading window from 09:00 to 17:00 server time.
8. Ensure only one trade can be active at a time.

# Output Format
Provide a detailed, step-by-step strategy description or pseudocode that includes all the above points:
- Input parameters and indicators,
- Entry conditions,
- Exit conditions,
- Risk management calculations,
- Time filter implementation,
- Trade management rules.

Create your own custom GPT chatbot with your own data and knowledge. Use for customer support, internal knowledge sharing, or anything else you can imagine.

Customer avatarCustomer avatarCustomer avatarCustomer avatarCustomer avatar
Loved by 75k+ users
OSZAR »