PropFirm AI Management
- Utilitaires
- Raka
- Version: 1.0
- Activations: 5
PropFirm AI Management is an Expert Advisor for MetaTrader 5 designed to assist traders operating under prop firm evaluation conditionsas well as independent personal trading. It integrates a generative AI pipeline with a structured multi-timeframe analysis engine, automated risk controls, and real-time position management — working within the specific constraints of funded account rules.
How It Works
PropFirm AI Management operates on a continuous timer cycle. On each tick, it evaluates a sequence of conditions before allowing any trade action: account permissions, exposure limits, momentum state, volatility phase, news proximity, and AI provider availability. When all conditions are satisfied, it submits market data to a connected AI provider and executes the resulting plan — provided the plan clears a second layer of risk and margin checks.
The EA does not place trades based on indicator signals alone. Every entry decision passes through an AI analysis step that receives candlestick data, 48 technical indicators per bar, multi-timeframe context, sentiment score, and upcoming news events. The AI provider determines direction and entry price; the EA independently calculates stop-loss from ATR and take-profit from the active momentum state's risk-reward ratio.
AI Integration
The EA supports 12 generative AI providers, configurable from the input panel:
- OpenAI (GPT-4o, GPT-4.1, o3, o4-mini)
- Google (Gemini 2.5 Pro, Gemini 2.0 Flash)
- Anthropic (Claude 4 Opus, Claude 4 Sonnet, Claude 3.7 Sonnet)
- DeepSeek (DeepSeek-V3, DeepSeek-R1)
- xAI (Grok 3, Grok 3 Fast, Grok 3 Mini)
- Alibaba (Qwen-Max, Qwen-Plus, Qwen-Turbo)
- Moonshot (Kimi-VL, Kimi-Latest)
- MiniMax (MiniMax-Text-01)
- Mistral (Mistral Large, Mistral Small)
- HyperCLOVA X (HCX-005, HCX-DASH-001)
- Falcon via AI71 (Falcon 180B, Falcon 40B, Falcon3 series)
- Meta Llama (Llama 4 Maverick, Llama 4 Scout, Llama 3.3 70B, Llama 3.1 405B)
All providers use the same prompt structure and response format. Switching providers requires only changing the InpAIProvider and InpAPIKey inputs — no other configuration change is needed.
Multi-Symbol Scanner
When the chart symbol produces a NO_TRADE result, the scanner activates and analyzes instruments across a selected category in a single batch. Each instrument is independently analyzed by the AI provider, results are ranked by probability, and the top candidates are executed — subject to the same risk gates as chart-symbol entries.
Available categories: Forex Major, Forex Minor, Forex Cross, Forex Exotic, Metals, Energies, Indices, Crypto, Stocks, or Custom list.
The scanner interval is tied to the active timeframe setting (InpAIDataTimeframe). At H1, the scanner runs at most once per hour. At M15, once per 15 minutes. A multiplier input (InpScanIntervalMult) allows extending the interval to a multiple of the base timeframe duration.
Risk Management
Risk is calculated in two independent layers:
Layer 1 — Direction risk per symbol (EA-only): The EA tracks open risk for each direction (BUY / SELL) separately, for positions and pending orders placed by this EA instance. A new entry is only permitted if the remaining quota in the same direction has room.
Layer 2 — Daily loss budget (account-wide): The EA monitors total open risk across all positions in the account — including positions from other EAs and manual trades — combined with realized losses since the equity peak of the current trading day. If this total reaches the configured daily loss percentage, no new entries are permitted and the scanner stops.
Protected position detection: When break-even or trailing stop moves the stop-loss to or beyond the entry price, the position's risk contribution is recalculated as zero. This frees up risk quota for new candidates without any manual action.
Position Management
For every owned position — including manual trades when the opt-in setting is enabled — the EA maintains the following on each timer cycle:
- SL/TP bootstrap: If a position has no stop-loss or take-profit (common with manually opened market orders), the EA automatically places them using ATR-based distance and momentum-derived R:R.
- Break-even: Moves stop-loss to entry plus commission and slippage offset when price reaches the configured ATR multiple from open.
- Trailing stop-loss: Follows price at a configurable ATR distance, with a minimum step to prevent unnecessary modifications.
- Trailing take-profit: Moves take-profit closer as momentum weakens, locking in profit progressively. Distance adapts to the strength of the active momentum state.
- Partial close: Closes a percentage of the position when price reaches the configured R:R multiple from entry.
AI Position Review
At configurable intervals, the EA submits an open position to the connected AI provider for a structured review. If the position is approaching its stop-loss (within 25% of the SL distance), the review interval is automatically reduced to 30 minutes.
The review assesses the current state of the position against live market data and can produce one of four outcomes: HOLD, CLOSE_NOW, TIGHTEN_SL, or PARTIAL_CLOSE. Each outcome is subject to its own permission input and a sanity check before being applied.
The most at-risk position across all open EA positions is reviewed first, regardless of which symbol it was opened on.
Entry Trigger Modes
Time-based (new bar): The EA analyzes on each new bar of the configured timeframe. A GlobalVariable mechanism prevents duplicate analysis when multiple instances share the same account.
Price action event-based: Three independent triggers can initiate analysis before a new bar forms — pivot level touch, ZigZag swing support/resistance touch, and confirmed candle patterns (pin bar, engulfing, morning/evening star). Each trigger type has its own cooldown timer, so a pivot touch does not block a candle pattern from triggering minutes later.
PropFirm Compatibility Features
- Daily loss limit enforcement: Configurable as a percentage of account balance. Triggered automatically by the monitoring loop.
- Risk per trade direction: Configurable as a limit to avoid gambling behaviour.
- Maximum drawdown limit: Configurable absolute drawdown threshold from the account balance.
- Trailing drawdown: Follows the equity peak, closing all positions when the threshold is breached.
- Overnight and weekend hold rules: Configurable close time before rollover and market close on Friday, with retry logic if the broker is in a halt period.
- News filter: Prevents new entries and optionally closes open positions during high-impact event windows.
- Consistency rule: Monitors best-day profit and restricts lot scaling to protect consistency metrics.
- Profit target: Closes all positions when a configured equity target is reached.
Multi-Instance and Multi-Pair Setup
Each EA instance is identified by a configurable magic number ( InpMagicNumber ). Running the same EA on multiple charts with different magic numbers allows independent management of each symbol without interference.
Position management functions — break-even, trailing stop, trailing TP, partial close, news close, drawdown close — all filter by magic number, so one instance does not modify positions opened by another.
Technical Architecture
- Language: MQL5, MetaTrader 5 only
- Data storage: SQLite (built-in MQL5 database) for trade journal, AI history, and indicator cache
- No DLLs, no external libraries
- Requires: MetaTrader 5 build 3600+, WebRequest permissions for AI API endpoints
Inputs Overview
| Group | Key Inputs |
|---|---|
| General | Timer interval, magic number, manual trade management |
| Generative AI | Provider, API key, model, temperature, timeout, retry |
| Lot Management | Base lot, volatility scaling, drawdown scaling, probability scaling |
| Risk / Drawdown | Max risk %, daily loss %, max DD %, trailing DD % |
| Risk-to-Reward | RR per momentum state (Core, H4, H8, D1, W1, MN1) |
| Trade Protection | BE multiplier, TSL trigger/distance/step, TTP distance |
| Partial Close | Enable, percentage, R:R trigger |
| Multi-Symbol Scanner | Enable, category, max entries, interval multiplier, skip if position |
| Price Action Trigger | Enable, cooldown, pivot method, ZigZag parameters |
| AI Position Review | Enable, interval, can close, can tighten |
| News Filter | Enable, minutes before/after, close before news |
| Holding Rules | Allow overnight, allow weekend, rollover hour |
| Consistency Rule | Enable, min days, target multiplier |
| Stacking Rule | Enable, max trades per direction |
All risk percentages, timeframes, and thresholds are fully configurable. No strategy is hardcoded. The EA provides the execution infrastructure; trading decisions remain with the configured AI provider and the trader's parameter choices.
