Gemini AI Trading Bot – User Manual
1. Introduction
The Gemini AI Trading Bot v1.00 is an advanced hybrid Expert Advisor (EA) developed for the MetaTrader 5 platform. By bridging the powerful structural trading capabilities of MQL5 with cutting-edge Large Language Models via the Google Gemini API, this EA acts as an autonomous AI-driven market analyst and execution system.
Unlike traditional algorithmic bots that rely solely on rigid indicator math, this EA exports deep multi-timeframe market data into structured JSON objects, broadcasts them directly to Google Gemini, and receives an institutional-grade, natural-language price action analysis coupled with explicit programmatic trading instructions (Buy, Sell, Close, or Modify Orders).
2. Core Functional Architecture
The bot utilizes a sophisticated blend of AI reasoning and systemic safety measures to scan, filter, and execute market setups:
2.1 Multi-Timeframe (MTF) Data Ingestion
During each analysis cycle, the EA extracts an array of Open-High-Low-Close-Volume (OHLCV) candle definitions across three separate timeframes to establish a strict top-down technical approach:
- H4 Timeframe: Establishes the primary market bias, macro structure, and institutional supply/demand zones.
- H1 Timeframe: Detects medium-term swing alignment and serves as directional confirmation.
- M15 Timeframe: Pinpoints the localized execution environment, micro liquidity sweeps, and immediate candlestick entries.
2.2 Smart Reversal Filter
To insulate your capital against aggressive stop-hunting and over-extended market cycles (especially prevalent on volatile instruments like Gold – XAUUSD), the EA embeds a native MQL5 Smart Reversal Filter. Before confirming an AI trade entry, it performs an algorithmic validation:
- Impulse Leg Exhaustion: Measures the momentum of the recent impulse move over a specified lookback period against the Average True Range (ATR). A movement exceeding the defined threshold signifies an exhausted leg.
- Wick Rejection Ratio: Analyzes the closest closed candle’s structural geometry. It checks if the lower wick (for Buy setups) or upper wick (for Sell setups) exceeds a specific percentage of the total candle range, filtering out generic breakouts.
2.3 Dual-Chain Dollar Cost Averaging (DCA) Hedge Grid
The EA features three flexible entry models, managing risk independently across parallel sequences via distinct tracking tokens (Magic Numbers):
- Single Shot: Executes a single order profile and enters a standby state until the trade is fully resolved via SL or TP before seeking the next entry.
- DCA by Step (Auto): Programmatically executes structural add-on orders based on a strict price-step model when an active trade runs into temporary drawdowns, operating entirely offline without demanding recurring AI confirmation calls.
- DCA Step + AI Confirmation: Merges grid mathematics with LLM oversight. Add-on grid tiers will only activate if the latest live Gemini API direction aligns with the running grid chain’s profile.
When grid structures are deployed, the EA automatically aggregates position metrics to recalculate an unified mathematical break-even point, projecting the chain’s overall Take Profit (TP) parameters at an explicit point distance away from the net volume average.
3. Step-by-Step Google Gemini API Key Setup
To enable communication between MetaTrader 5 and the Google Gemini models, you must obtain a valid API key and authorize the endpoint within your MT5 Terminal settings.
- Access Google AI Studio: Open your web browser and navigate to the official Google AI Studio developer portal at https://aistudio.google.com/.
- Authenticate with Google Account: Sign in using your standard Google or Google Workspace credentials. Review and accept the platform terms of service.
- Generate the API Key: Click on the prominent “Get API Key” button located in the sidebar or top navigation header. Select “Create API Key”, then allocate the key to either a new or existing Google Cloud Project.
- Securely Copy Your Key: A modal window will display a unique alphanumeric string beginning with
AIzaSy.... Copy this string immediately and store it securely. Treat this key like a private financial password; anyone possessing it can utilize your processing budget. - Configure MetaTrader 5 Security Options: Launch your MT5 Terminal. Navigate to the top menu and select Tools → Options (or press
Ctrl + O). Open the Expert Advisors tab. - Whitelist the Gemini Endpoint: Check the box labeled “Allow WebRequest for listed URL:”. Double-click the empty addition row and precisely paste the following endpoint address:
https://generativelanguage.googleapis.com
Click OK to save the configuration changes.
If you skip whitelisting this URL inside the MetaTrader 5 options, the terminal’s security engine will block all outgoing WebRequest packets, generating an execution error code 4014 (WebRequest internal error) in the Experts log window.
4. Parameter Reference Guide
The input parameters control the operational logic, risk profiles, and communication configurations of the EA:
4.1 API Configuration: Gemini AI Trading Bot
| Parameter Name | Default Value | Functional Description |
|---|---|---|
InpApiKey |
“” | Paste your alphanumeric Google Gemini API key here (starts with AIzaSy). |
InpModel |
MODEL_FLASH |
Selects the processing core model: gemini-2.5-flash, gemini-2.5-pro, or gemini-2.5-flash-lite. |
InpThinkingBudget |
0 | Allocates thinking tokens for models supporting reasoning capabilities. Set to 0 to disable, or -1 for dynamic budgeting. |
InpHttpTimeoutMs |
20000 | Maximum timeout window in milliseconds for the WebRequest API response. |
4.2 Trading Strategy & Multi-Timeframe Settings
| Parameter Name | Default Value | Functional Description |
|---|---|---|
InpStrategyType |
STRAT_TREND |
The structural ruleset context passed to the AI: Trend Following, Scalping, Swing Trading, etc. |
InpRiskLevel |
RISK_CONSERVATIVE |
Configures the risk profile: Conservative, Moderate, or Aggressive. |
InpCandleCountH4 |
20 | Total historical candles extracted from the H4 timeframe to analyze primary trend bias. |
InpCandleCountH1 |
20 | Total historical candles extracted from the H1 timeframe for structural confirmation. |
InpCandleCountM15 |
30 | Total historical candles extracted from the M15 timeframe for entry optimization. |
4.3 Execution & DCA Parameters: Gemini AI Trading Bot
| Parameter Name | Default Value | Functional Description |
|---|---|---|
InpEnableAutoTrade |
true | Enables or disables order execution. |
InpAutoUpdateMinutes |
15 | The execution frequency (in minutes) for recurring AI market evaluation cycles. |
InpDefaultLot |
0.01 | Initial volume sizing allocation for baseline positions. |
InpEntryMode |
ENTRY_SINGLE_SHOT |
Determines entry grid logic: Single Shot, DCA by Step (auto), or DCA Step + AI Confirm. |
InpDcaStepPoints |
3000 | The explicit minimum spacing distance measured in points required between active positions. |
InpHedgeTpPoints |
2000 | Take Profit offset distance in points applied to a grid sequence relative to its break-even point. |
5. Operational Workflow & Core Rules
5.1 Pre-Flight Safety Inspections
Before spending API resources, local verification processes validate current market conditions. The cycle immediately halts if the real-time spread exceeds InpMaxSpread, or if the current account drawdown crosses your InpMaxDailyLossMoney circuit breaker.
5.2 Top-Down Analysis Protocol
- Macro Identification: The model maps out underlying structures on the H4 data, identifying the core trend.
- Intermediate Alignment Check: The model moves down to the H1 context to verify if medium-term structural swings align with the broader H4 bias.
- Localized Entry Execution: The model evaluates the lower M15 structure exclusively to refine structural entries.
6. Charts Display & Graphical Interface: Gemini AI Trading Bot
- Header Control Status: Displays live operational readouts (e.g.,
Ready,Analyzing...,OK). - Account Performance Monitor: Tracks metrics like total running tickets relative to your caps, alongside real-time calculations tracking net daily currency returns.
- Interactive Synchronization Engine: Features an embedded “UPDATE” button. Clicking this element overrides the automated timer grid, capturing an immediate market snapshot.
Dowloads Gemini AI Trading Bot
https://t.me/boteafxdotcom/2/1358
More EA: https://eagalaxy.net/ea-bot/
Rebate Backcom
Register, trade, and earn your cashback at: https://one.exnessonelink.com/a/zhd53zgj4o

- Gold Killer EA v15 MT5 (No DLL) – Automated Gold Trading EA
- Account Statistic Indicator for MT4/MT5 – The Ultimate Trading Performance Dashboard :The best
- Fxblue copy MT4 & MT5 – Copy Trade FREE
- AI Gen XII EA MT4 – Next-Generation AI Trading with GPT FREE
- Private EA V1: Pure Mathematical Discipline for Automated Gold and BTC Trading


















