X AI Gold
- Uzmanlar
- Sürüm: 3.0
- Güncellendi: 3 Temmuz 2026
- Etkinleştirmeler: 5
Dependent on Broker's Calendar data: If the broker's server does not fully update its Economic Calendar database.
SETUP:
1. Get API key: https://console.x.ai/
2. MT5 -> Tools -> Options -> Expert Advisors -> Allow WebRequest
Add URL: https://api.x.ai
3. Attach to XAUUSD chart
4. Set GrokApiKey in Inputs tab
👉 Main cause: The API Key you are configuring for the EA belongs to an x.AI account that has not been topped up or configured with a payment card to purchase Credits. Although newly created accounts usually receive trial credits (if available), this API Key currently has a zero balance, so it cannot perform further analysis.
2. Solution
You can fix this error in the following two ways:
Method 1: Top up your current x.AI account with Credits (Recommended)
Click directly on the link in your log: https://console.x.ai/ (or access the management page https://console.x.ai/).
Log in using the account containing your API Key.
Go to Billing / Funding.
Add an international payment card (Visa/Mastercard) and deposit a small amount (e.g., $5 or $10) into the account.
Once the account has an available balance (Credit balance > 0), the old API Key will automatically become active again without needing to change to a new key.
Method 2: Change to a different API Key (if you already have another account with funds available)
If you have another x.AI account that has been funded and is functioning normally, create a new API Key from that account and update it in the EA in one of two ways:
Method A (Configure directly on the EA): In the EA's input settings window on the MT5 chart, find the === GROK API === section and paste the new API Key into the GrokApiKey field.
Method B (Save to file): Leave the GrokApiKey field blank in the EA's input settings. Next, open the MT5 data folder (File -> Open Data Folder -> go to the MQL5/Files folder), open the grok_key.txt file (create a new one if it doesn't exist), paste the new API Key into it, and save it. The EA will automatically read the key from this file.
1. SETTING INPUT PARAMETERS (EA INPUTS)
Open the EA properties panel on MT5 and set the parameters as follows:
Group 1: Configure AI API
GrokUseOnlyAPI = true (Required: Enable pure trading mode using Grok's text analysis)
GrokUseSMCPrompt = true (Required: Activate the SMC + MA Ribbon prompt)
GrokAPIBarsCount = 15 (Increase to 15 candles so Grok has a more detailed view of short-term wave structures)
GrokAPIBarsShift = 1 (Start analysis from the closed candle to ensure no noise signals)
Group 2: Configure Multi-Timeframe
To scalp using the multi-timeframe method, place the EA on the M1 or M5 chart (acting as the LTF), then configure the following parameters:
GrokMasterTF = PERIOD_D1 (Main trend filter frame: Day D1)
GrokHTF = PERIOD_H1 (Large Supply/Demand zone identification frame: H1)
GrokLTF = PERIOD_M15 (Intermediate frame identifying BOS breakout structure: M15)
GrokIntervalMin = 5 (EA calls API for re-analysis: every 5 minutes)
Group 3: SMC Configuration & Advanced Order Management
GrokSwingStrength = 5 (Strength of peaks/troughs to draw S/D and BOS. Number 5 is optimal to avoid short candle noise)
GrokUseMultiTP = true (Required: Splits orders into TP1, TP2, TP3 and automatically moves SL to break-even when TP1 is reached)
GrokMinConfidence = 0.70 (or 70%) (Filters noise signals. Only enters orders when Grok is confident of 70% or more)
Group 4: Capital & Risk Management
GrokLotMode = LOT_MODE_PERCENT (It is recommended to use a percentage of your account to automatically calculate lot size)
GrokRiskPercent = 0.5 (or 1.0) (Only risk a maximum of 0.5% - 1% of your account per setup because the SL of SMC is very short and Gold is highly volatile)
GrokUseTrailingStop = false (When scalping with SMC, it is preferable to keep the SL combined with Breakeven at TP1 instead of using Trailing Stop ATR to avoid being hit by an early SL sweep)
2. OPTIMAL TRADING RULES AND TIMES
Criteria Configuration & Rules Scalp Gold Reason
Timeframe for EA placement Placed directly on the M5 (or M1) chart M5 is the optimal entry timeframe to combine the compressive Ribbon MA band and confirmation candlesticks
Best trading hours 14:00 – 18:00 (European session) and 19:30 – 22:30 (US Session) Liquidity is high at this time, and the spread (buy-sell difference) for gold is at its lowest.
Avoid news hours. Temporarily pause the EA before and after strong news events (CPI, NFP, FOMC). Strong news events easily create price gaps (slip SL) and widen the spread.
Spread Filter: It is recommended to configure the maximum allowable spread for trading at 30-35 points (3-3.5 pips). Avoid scalping M1/M5 orders when the platform widens the spread, as this reduces the R:R ratio.
3. ACTUAL OPERATION MECHANISM OF THE SCALP ORDER v3.00
When you run this optimized set, the EA's operation process will be as follows:
MQL5 continuously scans: Finds H1 peaks/troughs, scans to see if M15 breaks the BOS, checks the compression of the EMA Ribbon (9, 21, 50, 200) on M5.
The Grok API receives refined data, analyzes the overall structure, and makes decisions:
Returns a BUY order at the current price, with a Stop Loss below the H1 Demand Zone bottom.
Provides 3 take-profit levels: TP1 (near resistance), TP2 (medium-term), TP3 (opposite Supply Zone).
Order management:
EA opens 3 small orders (e.g., $0.01 lot each).
Price increases to TP1 $\rightarrow$ Order 1 automatically closes and profits.
Immediately, EA adjusts the Stop Loss of Order 2 and Order 3 to the exact Entry price (Break-even). Trading from this point onwards is completely risk-free.
The rest of the position continues to run towards TP2 and TP3.
