/tradecraft:gold-orb-eafrom tradecraft
MQL5 Expert Advisor for XAUUSD 1H Opening Range Breakout strategy. Detects opening range, confirms consolidation, then trades breakouts with dynamic position sizing and trailing stop.
Ships in tradecraft. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
USE FOR:
MQL5 Expert Advisor for XAUUSD 1H Opening Range Breakout.
Market open: 1:02 AM server time
First 1H candle → defines initial support (low) and resistance (high)
Wait for N consecutive candles to close WITHIN the range
Default N = 3 (user-adjustable)
Range becomes "final" only after consolidation confirmed
Signal 11 → Price BREAKS ABOVE resistance → BUY
Signal 10 → Price BREAKS BELOW support → SELL
Signal 0 → No breakout → No trade
| Parameter | Default |
|---|---|
| Take Profit | 1,200 points |
| Stop Loss | 400 points |
| R:R Ratio | 3:1 |
| Max trades/day | 2 (1 long + 1 short independently) |
| Risk per trade | 1% of account balance |
| Max equity drawdown | 10% |
// Candle detection
class new_candle_check2 {
bool IsNewCandle(); // Returns true on new H1 candle open
}
// Core strategy
class Open_Range_Breakout {
int GetSignal(); // Returns: 11=BUY, 10=SELL, 0=NONE
// Internally tracks: range high, range low, candle count
}
// Execution (built-in MQL5 classes)
CTrade trade; // Order send / modify / close
CTrailing trailing; // Dynamic stop-loss trailing
// OnInit — setup
int OnInit() {
// Validate symbol, timeframe
// Initialize ORB object
// Set risk parameters
return INIT_SUCCEEDED;
}
// OnTick — main logic
void OnTick() {
if (!new_candle.IsNewCandle()) return; // Only act on new H1 candle
int signal = orb.GetSignal();
if (signal == 11 && long_enabled && daily_buys < 1) {
double lot = CalcLotSize(risk_pct, sl_points);
trade.Buy(lot, _Symbol, 0, sl_price, tp_price, "GOLD_ORB_BUY");
daily_buys++;
}
if (signal == 10 && short_enabled && daily_sells < 1) {
double lot = CalcLotSize(risk_pct, sl_points);
trade.Sell(lot, _Symbol, 0, sl_price, tp_price, "GOLD_ORB_SELL");
daily_sells++;
}
// Check drawdown limit
if (GetEquityDrawdown() > max_drawdown_pct) CloseAllPositions();
}
double CalcLotSize(double risk_pct, int sl_points) {
double account_balance = AccountInfoDouble(ACCOUNT_BALANCE);
double risk_amount = account_balance * risk_pct / 100.0;
double tick_value = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE);
double lot = risk_amount / (sl_points * tick_value);
return NormalizeDouble(lot, 2);
}
| Feature | Detail |
|---|---|
| Dynamic sizing | % of account balance per trade |
| Max drawdown | Hard stop at 10% equity loss |
| Daily trade limit | 1 long + 1 short max |
| Losing streak detection | Reduces size after N consecutive losses |
| Virtual simulation | Test without real orders |
| Independent long/short | Can disable either direction |
1. Clone repo → copy folder to:
C:\Users\[user]\AppData\Roaming\MetaQuotes\Terminal\[ID]\MQL5\Experts\GOLD_ORB\
2. Open MetaEditor → recompile .mq5 files
3. Open XAUUSD H1 chart in MT5
4. Drag EA from Navigator → attach to chart
5. Configure inputs:
- Enable/disable long/short
- Adjust risk_pct, max_drawdown_pct
- Set candle consolidation threshold (default 3)
- Enable trailing stop if desired
Gold ORB works well because:
- London open (2-3 AM NY time) creates sharp directional moves
- Asia session establishes clear range (low volatility consolidation)
- Breakout of Asia range at London/NY open = high-probability continuation
Optimal configuration for gold:
- Range period: Asian session (22:00–02:00 server)
- Breakout time: London open (02:00–04:00 server)
- Filter: Only trade if range width > 5 ATR (avoid false breakouts)
- Exit: Trail stop after 1R achieved
The framework is designed to be adapted:
// Change symbol
input string TradingSymbol = "EURUSD"; // or "GBPJPY", "US30", etc.
// Adjust open time per symbol's market open
input string MarketOpenTime = "08:00"; // London for forex
// Adjust TP/SL to match symbol volatility (in points)
input int TakeProfit = 300; // Tighter for forex vs gold
input int StopLoss = 150;
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
mql5, mt5, expert-advisor, gold-trading, breakout-strategy, forex
npx claudepluginhub mahmoud20138/tradecraft --plugin tradecraft169 skills in this plugin
/agent-developmentThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins./agentic-storageAgentic storage architecture — persistent memory for AI agents using MCP, immutable versioning, sandboxing, and intent validation. Covers the stateless problem in LLM agents, RAG limitations (read-only), MCP protocol (JSON-RPC, resources, tools), storage safety layers, and agent file system design. Source: IBM Technology (Martin Keen), March 2026. Use this skill for "agentic storage", "agent memory", "persistent agent state", "MCP storage", "agent file system", "agent hard drive", "stateless agent problem", "agent work product", "immutable versioning", "agent sandboxing", "intent validation", "agent safety layers", "agent context window limits", "storage for AI agents", "agent persistence", "autonomous agent storage", "agent audit trail". Works with mcp-integration, trading-brain, agents, trade-psychology-coach.
Other plugins' skills for the same job