Authoring Guide

How to write a prompt file the EA can actually trade with.

The EA loads your strategy presets from a single text file into the 2.1 PresetStrategy dropdown — one file holds up to 16 presets. This guide walks you from "where to save it" to a fully working example, so the AI council debates your setup, not the built-ins.

~10 min read 7 sections Encoding: ANSI Max: 16 presets / file
Step 01

Where & how to save the file

Drop it in the right folder, with the right encoding, with the right filename. The EA reads it once at attach-time.

  • Path <MT5 Data Folder>\MQL5\Files\eatrading_prompts.txt  — in MT5: File → Open Data Folder → MQL5 → Files.
  • Encoding ANSI (Notepad → Save As → Encoding: ANSI). UTF-16 LE also works. Avoid UTF-8 with BOM.
  • Filename must match input 2.10 PresetFile exactly.

Verify it loaded. After saving, remove the EA from the chart and drag it back. Check the Experts tab — you should see PromptLibrary loaded N presets. If not, jump to Common Errors.

Step 02

File syntax

A flat, line-based format. Each preset is a [PRESET]…[/PRESET] block with a STRATEGY and a RULES section inside.

eatrading_prompts.txt
# Lines starting with # are comments
# All markers MUST be at column 0 (no indentation)

[PRESET]
NAME=Short Name               required, <30 chars
SUMMARY=One-line hint         optional
WHITELIST=EMA,ATR,RSI        optional, comma-separated, no spaces
TIMEFRAME=H4                 optional (H4, D1, M15…)
STRATEGY_BEGIN
...multi-line strategy...
STRATEGY_END
RULES_BEGIN
...multi-line rules...
RULES_END
[/PRESET]
Parser rules
  • Missing NAME → file rejected (falls back to built-ins).
  • Unclosed block (no STRATEGY_END, RULES_END, or [/PRESET]) → file rejected.
  • Unknown keys → silently ignored. Spell things right.
  • Hard cap: 16 presets per file. Anything beyond is dropped.
!

Indentation kills the file. Markers like [PRESET], STRATEGY_BEGIN, RULES_END must start at column 0. A leading space or tab and the parser sees zero blocks.

Step 03

STRATEGY block — teach the AI how to think

This is what the Analyst, Bull, and Bear agents read. Write it like you're briefing a junior trader: mechanism first, then signals, then both sides of the argument.

=== HYPOTHESIS ===

Why does this strategy have an edge?

One or two sentences. Talk about the market mechanism — order flow, volatility regime, mean reversion — not the indicator setup. "Bull / bear traps after extended moves" beats "RSI < 30".

=== MARKET REGIME ===

When does it work, when does it die?

  • WORKS in: <regime — e.g. trending, low-vol range, post-news drift>
  • FAILS in: <regime — e.g. chop, news spikes, gap opens>
=== KEY OBSERVATIONS ===

What's each indicator for?

  • Indicator → role (e.g. EMA(200) → trend filter)
  • Signal → meaning (e.g. RSI>70 → exhaustion, not entry)
=== BULL ANGLES ===

Quantified reasons to go long

  • Price > EMA(200) on H4
  • Stoch %K < 20 crossing up
  • ATR(14) < 1.5× ATR(50) — calm enough to hold
=== BEAR ANGLES ===

Quantified KILL conditions

  • Daily close below 20EMA → invalidate long thesis
  • VIX > 30 → skip mean-reversion longs
  • Spread > 2× median → no entry
=== CONFIDENCE GUIDANCE ===

How to tier the verdict

Define what "all clean", "partial", and "blocked" actually mean for this strategy — see the ladder below.

High
All bull angles satisfied. No bear angle triggered. Volatility inside the working regime. Take full size.
Medium
2 of 3 bull angles. One soft warning. Reduce size or wait for confirmation candle.
Hold
Any bear KILL condition active, or fewer than 2 bull angles. Stand down. No trade.
i

Balance is non-negotiable. Equal counts of Bull and Bear angles, or the AI biases long. The Bear agent needs ammo — give it explicit kill conditions, not vibes.

Step 04

RULES block — execution parameters

Where STRATEGY teaches the AI to think, RULES tells it what to do once it decides to enter. Keep it numeric and ATR-relative.

=== ENTRY MECHANICS ===

Order type · timing · confirmation

Market vs limit, bar-close confirmation, retest entry. State explicitly when the entry trigger expires.

=== STOPS ===

SL · TP · Trailing

  • Hard SL: 2.0 * ATR(14)
  • Take Profit: 3.0 * ATR(14)
  • Trailing: activate after 1.0*ATR favorable
=== SIZING ===

Risk per trade

  • Risk: 1.0% of equity per position
  • Max portfolio heat: 3% across open trades
=== SESSION & VOLATILITY GATES ===

When NOT to trade

  • Session window: 12:00–20:00 UTC
  • Skip news: NFP, FOMC, CPI ±2h
  • Skip if ATR(14) > 2.5× ATR(50)
=== POSITION RULES ===

Concurrency & cooldown

Max 1 open position. No DCA. No averaging-down. Cooldown of 4 bars after any stop-out before re-entering the same direction.

!

ATR-based stops only. Pip-based stops break across symbols and timeframes — "20 pips" on EURUSD is noise on XAUUSD. Express SL, TP, and trailing in multiples of ATR(14) so the same preset survives a symbol swap.

Step 05

Quality checklist

Read your preset back top-to-bottom and confirm each row. If you can't, fix it before loading the file.

01

Quantify everything

"Stoch %K < 20 crossing up", not "oversold". The AI cannot act on adjectives.

02

Balance bull and bear angles

Equal count, or the AI biases long. Three for three is a good baseline.

03

State KILL conditions explicitly

The Bear agent needs ammunition. "Don't enter if X" is a hard gate, not a hint.

04

ATR-based stops only

Auto-adapts across symbols. Pip-based stops are a portability bug.

05

One preset = one edge

Don't stack a trend-following entry with a mean-reversion exit. Make a second preset instead.

06

English, ASCII only

No Vietnamese diacritics, no smart quotes, no em-dashes. Avoids encoding garble inside the AI prompt.

07

Demo before sharing

Run the preset on a demo account for at least one full session before publishing or selling it. Never ship unverified prompts.

Step 06

Common errors

Five symptoms cover ~95% of broken prompt files. The Experts log tells you which one you hit.

Symptom Cause Fix
Only built-ins in the dropdown File didn't load at all. Open the Experts tab, find PromptLibrary entries, re-save as ANSI.
Log: no NAME The NAME= line is missing inside a [PRESET] block. Add it. NAME is required and must be <30 chars.
Log: Unterminated block A STRATEGY_END, RULES_END, or [/PRESET] is missing. Close the block. Each _BEGIN needs its _END.
Log: zero [PRESET] blocks Markers are indented, or the file is in the wrong encoding. Move all markers to column 0. Re-save as ANSI.
Garbled text inside the AI debate UTF-8 BOM or non-ASCII characters slipped in. Save as ANSI. Strip diacritics, smart quotes, em-dashes.
Step 07

Full working example — Donchian-20 Turtle

A complete, parser-valid preset built from the classic Turtle Trading rules (Richard Dennis, 1983). Copy it as-is, or use it as a template — every required section is filled in with real, deployable content.

eatrading_prompts.txt — Donchian-20 Turtle Breakout
# =============================================================================
# DONCHIAN-20 TURTLE BREAKOUT — Quant AI Agents Prompt Library
# =============================================================================
# Source     : Classic Turtle Trading rules (Richard Dennis, 1983)
#              "Way of the Turtle" by Curtis Faith
# Backtest   : 20 US futures markets including gold, 1990-2025
# Win Rate   : ~45% (low — characteristic of trend-following)
# Profit Fac : 1.5+
# Confidence : Verified across multiple decades and instruments
# Transfer   : LOW (gold in original universe)
#
# DEPLOY:
#   1. Save this file as eatrading_prompts.txt in MQL5\Files\ (encoding: ANSI)
#   2. Or append the [PRESET] block below to your existing prompts file
#   3. Reload EA on chart
# =============================================================================

[PRESET]
NAME=Donchian-20 Turtle
SUMMARY=~45% WR / PF 1.5+ — channel breakout, trend-following
WHITELIST=Donchian,ATR
TIMEFRAME=H4
STRATEGY_BEGIN
=== HYPOTHESIS ===
Sustained moves come from genuine breakouts of recent N-bar ranges. We accept low win rate to capture the few large trends. Classic Donchian-20 Turtle adapted to XAUUSD H4.

=== MARKET REGIME ===
WORKS in: regime transitions, fundamental catalyst phases, sustained directional moves.
FAILS in: ranging chop, mean-reverting markets, post-news whipsaws.

=== KEY OBSERVATIONS ===
- Donchian-20 upper = highest High of last 20 bars; lower = lowest Low of last 20 bars.
- ATR(14) vs ATR(50) ratio = volatility expansion gauge (genuine breakout needs expansion).
- Recent failed breakouts = whipsaw zone (avoid re-entry).

=== BULL ANGLES (long breakout) ===
- Current bar CLOSES above Donchian-20 upper (not just wicks above)
- ATR(14) > ATR(50) average -> volatility actually expanding
- No failed breakout in last 4 bars (no whipsaw)
- No recent swing high directly overhead within 1*ATR (room for follow-through)

=== BEAR ANGLES (invalidate breakout) ===
- Wick-only breach (close back inside range) -> false breakout, KILL
- ATR(14) flat/declining vs ATR(50) -> low-conviction breakout
- Within 4 bars of a losing breakout -> whipsaw zone
- Right at major weekly/daily structure -> high reversal odds
- Symmetric for shorts: close below Donchian-20 lower with same filters

=== CONFIDENCE GUIDANCE ===
HIGH: clean close beyond Donchian + ATR expanding + no whipsaw history + clear path
MEDIUM: close beyond Donchian but ATR not expanding OR overhead structure near
HOLD: wick-only OR within whipsaw cooldown OR low-volatility regime

Note: this is trend-following — accept ~45% WR for large R:R via trailing stops.
STRATEGY_END
RULES_BEGIN
=== ENTRY MECHANICS ===
Order type: market on bar close confirmation (not intra-bar wick).

=== STOPS ===
- Hard SL: 2.0 * ATR(14) from entry
- No fixed TP — exit via trailing
- Trailing: Donchian-10 opposite channel (long exits if close < 10-bar low; short exits if close > 10-bar high)

=== SIZING ===
- Risk per trade: 0.5-1.0% of equity
- Lot from 2.0*ATR SL distance

=== SESSION & VOLATILITY GATES ===
- Trade 24/5; avoid Friday after 18:00 UTC
- Skip +/-2h around NFP/FOMC/CPI
- Skip if ATR(14) flat vs ATR(50) (low-conviction breakout)

=== POSITION RULES ===
Max 1 open per direction. No pyramiding in this preset.
Cooldown: skip new entry for 4 bars after a stopped-out breakout.
RULES_END
[/PRESET]
16
Max presets / file
<30
Chars in NAME
ANSI
Required encoding
col 0
Marker indent

You're ready. Save it, re-attach the EA, watch the Experts tab confirm PromptLibrary loaded N presets, and pick your new preset from the 2.1 PresetStrategy dropdown. The council takes it from there.