Prompt Models Guide
Learn how to create powerful trading strategies using NervaTrade's Prompt Model system
What are Prompt Models?
Prompt Models are the heart of the NervaTradeAI system. They define how the AI analyzes the market and makes trading decisions. Each model is a structured XML document that contains your trading strategy, conditions for entering trades, and instructions for analyzing market data.
Prompt Model Structure
After extensive testing, we've found that the most effective format for prompt models follows this XML structure:
<strategy> <general_instructions> Your overall strategy description and rules </general_instructions> <buy_conditions> Specific conditions for LONG positions </buy_conditions> <sell_conditions> Specific conditions for SHORT positions </sell_conditions> <neutral_conditions> Conditions for staying out of the market </neutral_conditions> <data_sources> Market data to analyze </data_sources> </strategy>
This structure helps the AI understand your trading strategy and apply it to market data in a systematic way.
Special Tags
The NervaTradeAI Expert Advisor supports several special tags that allow you to include dynamic market data in your prompt models:
@SYMBOL
Represents the current chart symbol where the EA is attached. This allows you to create dynamic prompt models that work across multiple trading instruments.
@SYMBOL
@{@SYMBOL,OHLC[TIMEFRAME,BARS]}
Retrieves OHLC (Open, High, Low, Close) and volume data for the specified symbol, timeframe, and number of bars. For example, @{@SYMBOL,OHLC[M5,500]}
fetches the last 500 M5 candles for the current symbol.
You can also specify other symbols for correlation analysis, like @{EURUSD,OHLC[H1,100]}
.
@{@SYMBOL,OHLC[M5,500]}
@SCREENSHOT[@SYMBOL,TIMEFRAME,TEMPLATE(TEMPLATE_NAME)]
Takes a screenshot of the chart with the specified symbol, timeframe, and template. This allows the AI to see the chart with indicators, making it possible to identify patterns visually.
The template must be saved in the MQL5/Profiles/Templates/ folder. You can create custom templates with your preferred indicators in MetaTrader 5.
@SCREENSHOT[@SYMBOL,M5,TEMPLATE(SMC_4_1.tpl)]
Best Practices
- Avoid overloading the AI with too much data to prevent hallucinations and slow processing
- Be specific about your trading conditions and rules
- Use multiple timeframes for better context and confirmation
- Pro and Premium users can pass multiple screenshots combining different timeframes or symbols for more comprehensive analysis
- Save your templates in the correct folder:
MQL5/Profiles/Templates/
- Organize your prompt model with clear sections and labels
Example Prompt Model
Here's a complete example of a Smart Money Concept strategy using EMAs. You can copy this example and modify it for your own trading style:
<strategy> <general_instructions> The strategy exploits Smart‑Money‑Concept (SMC) tools - Order Blocks (OB), Liquidity Sweeps, Fair‑Value Gaps (FVG) and volume - to capture institutional footprints on the **M5** execution timeframe. The M15 and H1 timeframes provide directional context. Four Exponential Moving Averages (EMAs) are plotted on every timeframe and colour‑coded: - EMA‑5 : red - EMA‑10 : yellow - EMA‑60 : turquoise - EMA‑223 : magenta ***Chart‑cleanliness rule*** If, during the last 12 completed M5 candles, price intersects at least **three** of the four EMAs >= 5 times (i.e. the EMAs are tangled with no clear stacking), the chart is deemed *dirty* and the output must be **"NEUTRAL"**. On every new M5 candle the AI returns exactly one of: **"LONG"**, **"SHORT"**, or **"NEUTRAL"** and then waits for the next candle. </general_instructions> <!-- LONG SET‑UP > <buy_conditions> 1. <market_structure> - On **M5** a bullish Break‑of‑Structure (BOS) *or* Change‑of‑Character (CHoCH) has formed. - **M15** and **H1** bias are bullish or neutral (last swing high has not been violated to the downside). </market_structure> 2. <ema_alignment> Trend‑following entry: EMA‑5 > EMA‑10 > EMA‑60 > EMA‑223 and price trades above EMA‑10. Counter‑trend entry: price sweeps below EMA‑223, prints a bullish rejection candle, then closes back above EMA‑60; EMA‑223 is treated as key support. </ema_alignment> 3. <order_block> Price pulls back into a bullish OB (demand) that created the recent BOS/CHoCH and shows rejection with above‑average volume. </order_block> 4. <liquidity_sweep> A stop‑run below a recent M5 low is followed by an engulfing or pin‑bar reversal that closes above that low. </liquidity_sweep> 5. <fair_value_gap> A bullish FVG lies between the sweep candle and the OB and has not yet been fully filled. </fair_value_gap> 6. <volume_confirmation> At either the OB touch or the sweep candle there is a clearly identifiable volume spike versus the last 20 M5 bars. </volume_confirmation> </buy_conditions> <!-- SHORT SET‑UP > <sell_conditions> 1. <market_structure> - On **M5** a bearish BOS or CHoCH has formed. - **M15** and **H1** bias are bearish or neutral (last swing low has not been violated to the upside). </market_structure> 2. <ema_alignment> Trend‑following entry: EMA‑5 < EMA‑10 < EMA‑60 < EMA‑223 and price trades below EMA‑10. Counter‑trend entry: price sweeps above EMA‑223, prints a bearish rejection candle, then closes back below EMA‑60; EMA‑223 is treated as key resistance. </ema_alignment> 3. <order_block> Price pulls back into a bearish OB (supply) that created the recent BOS/CHoCH and shows rejection with above‑average volume. </order_block> 4. <liquidity_sweep> A stop‑run above a recent M5 high is followed by an engulfing or pin‑bar reversal that closes below that high. </liquidity_sweep> 5. <fair_value_gap> A bearish FVG lies between the sweep candle and the OB and has not yet been fully filled. </fair_value_gap> 6. <volume_confirmation> At either the OB touch or the sweep candle there is a clearly identifiable volume spike versus the last 20 M5 bars. </volume_confirmation> </sell_conditions> <!-- STAY NEUTRAL > <neutral_conditions> The output must be **"NEUTRAL"** when *any* of the following is true: 1. <dirty_chart> Chart‑cleanliness rule (see General Instructions) is violated. </dirty_chart> 2. <range_or_low_volume> M5 shows no valid BOS/CHoCH and 20‑bar ATR is below its 50‑bar SMA (low volatility). </range_or_low_volume> 3. <timeframe_misalignment> M5 setup conflicts with M15 or H1 directional bias. </timeframe_misalignment> 4. <missing_confluence> No valid OB, FVG, or liquidity sweep is present near current price. </missing_confluence> </neutral_conditions> <!-- DATA FEEDS > <data_sources> <!-- Execution and pattern recognition > @{@SYMBOL,OHLC[M5,500]} @{@SYMBOL,OHLC[M15,300]} <!-- Context > @{@SYMBOL,OHLC[H1,200]} <!-- Screenshots with the new template > @SCREENSHOT[@SYMBOL,M5,TEMPLATE(SMC_4_1.tpl)] </data_sources> </strategy>
Commentary on the Example
This prompt model implements a Smart Money Concept strategy that looks for institutional footprints in the market. Let's break down the key components:
General Instructions
Defines the overall strategy using SMC tools (Order Blocks, Liquidity Sweeps, Fair Value Gaps) and four EMAs. It includes a "chart-cleanliness rule" to avoid trading in choppy markets.
Buy & Sell Conditions
Detailed conditions for long and short entries, including market structure analysis, EMA alignments, order block identification, liquidity sweeps, fair value gaps, and volume confirmation.
Neutral Conditions
Conditions where the AI should avoid trading, such as dirty charts, ranging markets, timeframe conflicts, or lack of confluence.
Data Sources
Specifies the market data to analyze: OHLC data from multiple timeframes (M5, M15, H1) and a screenshot of the M5 chart with a specific template.