Version 7.50 2026.01.22
Before (v7.4):

There are 6 Groq keys, but only key #1 is used.
Stuck after ~6 hours when key #1's rate is limited.
EA stops working.

After (v7.5):

Automatically rotates through all 6 keys.
Each key processes ~6-8 hours.
Total: 36-48 hours of continuous operation!

If all 6 Groq keys are used up, automatically switches to 3 Gemini keys.
Total final: ~54-66 hours of non-stop operation!

DETAILS OF FIX
Rate Limit Detection:

Groq: "rate_limit", "quota"
Gemini: "RESOURCE_EXHAUSTED", "429"
ChatGPT: "insufficient_quota"
Claude: "overloaded"

Safety Features:

Max 10 key retries per provider
1 second sleep between retries
Clear status messages
Fallback to next provider if all keys fail FILES
Version 7.40 2026.01.22
✅ COMPLETED - EA v7.4 PREDICTIVE
Successfully fixed 2 main issues:
1. ✅ REASONING FRAME OVERFLOW FIX
Before (v7.30):

Maximum 3 lines × 50 chars = 150 chars
Text overflows the frame
Unnatural text clipping

After (v7.40):

Maximum 5 lines × 62 chars = 310 chars
Dynamic height (automatically adjusts)
Smart break at space/comma/period/semicolon
Finds break point in the last 20 chars of the line
Adds "..." when truncate

2. ✅ ADDED AI PREDICTIVE ANALYSIS
Before (v7.30):

Only analyzes past data
Enters trades AFTER price reaches level
No pattern recognition

After (v7.40):

Candlestick Pattern Recognition:

HAMMER (bullish) reversal)
SHOOTING STAR (bearish reversal)
DOJI (indecision)
ENGULFING (strong reversal)
STRONG BODY (continuation)


Predictive Features:

Predict next candle direction
Early entry signals
Momentum detection (3+ bull/bear)
Enter the order BEFORE the price hits the level
AI analyzes patterns to ANTICIPATE moves


New JSON Fields:

nextCandlePrediction: BULLISH/BEARISH/NEUTRAL
priceActionPattern: Pattern detected
predictedMove: Prediction logic
Version 7.30 2026.01.22
1. API only reads Groq ✅

Cause: EA did not call LoadAPIKeysFromFile() before InitializeProviderStatus()
Fixed: Added load API keys BEFORE initializing providers
Result: All providers (Groq, Gemini, ChatGPT, Claude) now work at 100%

2. AI does not predict entry points ✅

Cause: Prompt requires AI to perform reactive analysis (after price movement)
Fixed: Updated prompt to require predictive analysis with:

Analysis of leading indicators (MACD, RSI divergence, BB squeeze)
Predict entry price BEFORE the price arrives
Estimate timing (number of candles to wait for)

Result: AI now predicts bounce/rejection points, no longer chasing prices
Version 7.21 2026.01.08
File FIX_API_CONNECTION.txt

Version 7.20 2026.01.07
==========================================================================
GUIDE TO USING EA LEGACY OF GANN MULTI AI PRO v7.2

==========================================================================

VERSION: v7.2 - SUPPORTS MULTIPLE API KEYS FOR EACH PROVIDER
RELEASE DATE: 2025-01-07

==========================================================================
NEW FEATURES IN v7.2

==========================================================================

✨ SUPPORTS MULTIPLE API KEYS FOR EACH PROVIDER

- You can add 2, 3, 5, 10... keys for the same provider

- Example: GROQ=key1, GROQ=key2, GROQ=key3

✨ AUTOMATIC KEY SWITCHING WHEN CREDIT EXPIRES

- When key1's credit expires => Automatically switches to key2

- When key2's credit expires => Switch to Key3

- When all keys are exhausted => Switch to another provider

✨ TESTING ALL KEYS BEFORE SWITCHING PROVIDER

- EA will test all keys of the Primary AI

- Only switch to another provider when all keys are faulty

✨ DISPLAY NUMBER OF KEYS

- Journal: Displays "GROQ: 3 keys"

- Panel: Displays "GQ:3 GM:2 GPT:1"

✨ MONITORING ERRORS FOR EACH KEY INDIVIDUALLY

- Each key has its own error counter

- Switch keys when errors occur too many times

==========================================================================
WHY DO WE NEED MULTIPLE API KEYS?

==========================================================================

1. INCREASE REQUEST LIMITS:

✓ Each key has a request/minute limit

✓ More keys => More requests => EA operates more stably

2. AVOID CREDIT RUNNING OUT IN THE MIDDLE OF A SESSION:

✓ Divide credits into multiple keys

✓ When key1 runs out => Automatically switch to key2

✓ No transaction interruption

3. BACKUP AND REPLACEMENT:

✓ If key1 is locked => Key2 and key3 remain

✓ Reduce the risk of AI connection loss

4. OPTIMIZATION OF COSTS:

✓ Prioritize using free keys (Groq, Gemini)

✓ Only use paid keys when necessary

==========================================================================
INSTALLATION AND CONFIGURATION HINH
========================================================================================

BUOC 1: COPY FILE EA
---------------------
Copy "LegacyOfGann_MultiAI_Pro_v7_2.mq5" into:
C:\Users\[TenMay]\AppData\Roaming\MetaQuotes\Terminal\[ID]\MQL5\Experts\

BUOC 2: COMPILE EA
-------------------
Open MetaEditor (F4 in MT5) => Press F7 to compile

BUOC 3: CREATE FILE API KEYS
--------------------------
1. Create a new file: AI_API_Keys.txt
2. Save to: MQL5/Files/
3. Directions for quick content:

# API files Keys
GROQ=gsk_key1_your_key
GROQ=gsk_key2_your_key
GROQ=gsk_key3_your_key
GEMINI=AIza_key1_your_key
GEMINI=AIza_key2_your_key
CHATGPT=sk_key1_your_key

STEP 4: GET API KEYS FROM PROVIDERS
-----------------------------------------

A) GROQ (FREE - RECOMMENDED):

✓ Access: https://console.groq.com/keys

✓ Register ACCOUNT 1

✓ Create API key => Copy to file: GROQ=key1

✓ Register ACCOUNT 2 (using a different email)

✓ Create API key => Copy to file: GROQ=key2

✓ Repeat for 3-5 accounts

👉 TIP: Use Gmail + trick (e.g., email+groq1@gmail.com)

B) GEMINI (GOOGLE - FREE):

✓ Access: https://makersuite.google.com/app/apikey

✓ Log in to GOOGLE ACCOUNT 1

✓ Create API key => Copy: GEMINI=key1

✓ Log in to GOOGLE ACCOUNT 2

✓ Create API key => Copy: GEMINI=key2

👉 TIP: Each Google account = 1 key, create 2-3 accounts

C) CHATGPT (OPENAI - PAID):

✓ Access: https://platform.openai.com/api-keys

✓ Deposit money (e.g., $50)

✓ Create MULTIPLE keys, each key with its own limit:

- Key1: Limit $15

- Key2: Limit $15

- Key3: Limit $20

✓ Copy all keys to a file

👉 TIP: Divide credits into smaller amounts for easier management

D) CLAUDE (ANTHROPIC - CO PHI):

✓ Access: https://console.anthropic.com/

✓ Deposit credits

✓ Create multiple API keys

✓ Copy to a file

STEP 5: TESTING EA
--------------------
1. Drag EA onto the chart
2. View Journal (Ctrl+T), you should see:

========================================
SUCCESS: 8 API keys read

GROQ: 3 keys

GEMINI: 2 keys

CHATGPT: 2 keys

CLAUDE: 1 key

========================================
3. Press T to test the connection
4. Check the display panel: "GQ:3 GM:2 GPT:2 CL:1"

============================================================================
OPTIMAL CONFIGURATION FOR VARIOUS BUDGET TYPES

==========================================================================

1. $0 BUDGET (COMPLETELY FREE):

-----------------------------------
Strategy: Use only Groq + Gemini

Config file:
GROQ=key1
GROQ=key2
GROQ=key3
GROQ=key4
GROQ=key5
GEMINI=key1
GEMINI=key2
GEMINI=key3

EA configuration:
- Primary AI: GROQ
- Enable Auto Fallback: BAT
- Enable Groq: BAT
- Enable Gemini: BAT
- Enable ChatGPT: TAT
- Enable Claude: TAT

Advantages:
✓ 100% Free
✓ 8 keys to rotate Round
✓ No worries about running out of credit

Disadvantages:
✗ Average AI quality
✗ May be slower than ChatGPT/Claude

2. BUDGET $20-50:

-----------------
Strategy: Groq + Gemini + ChatGPT add-on

Config file:
GROQ=key1
GROQ=key2
GROQ=key3
GEMINI=key1
GEMINI=key2
CHATGPT=key1 (limit $10)
CHATGPT=key2 (limit $10)

EA configuration:

- Primary AI: GROQ
- Enable Auto Fallback: BAT
- All providers: BAT

Advantages


# ============================================================
# API KEYS CONFIGURATION FILE FOR EA LEGACY OF GANN MULTI AI PRO v7.2
# ============================================================
# # NEW FEATURES v7.2:
# - Supports MULTIPLE API keys for each provider
# - Automatically transfers keys when credits run out or errors occur
# - Tests all keys before transferring to another provider
#
# ============================================================
#
# INSTRUCTIONS:
# 1. Rename this file to: AI_API_Keys.txt
# 2. Place the file in the folder: MQL5/Files/
# 3. Format: PROVIDER=API_KEY
# 4. One line = one API key
# 5. You can enter MULTIPLE KEYS for the same provider
# 6. Lines starting with # or // are comments
#
# ============================================================
# ==================== GROQ API ====================
# Download: https://console.groq.com/keys
# FREE, FASTEST
# You can create multiple API keys for continuous use

GROQ=gsk_abc123xyz456key1...
GROQ=gsk_abc123xyz456key2...
GROQ=gsk_abc123xyz456key3...

# When key1 runs out of credit or is faulty, EA automatically switches to key2

# Then key3, then back to key1 (loop)

# ==================== GEMINI API ====================
# Download: https://makersuite.google.com/app/apikey

# GOOGLE - FREE
# Each Google account can create 1 API key

GEMINI=AIzaSyAbc123xyz456key1...
GEMINI=AIzaSyAbc123xyz456key2...

# If you have multiple Google accounts, create a key for each account
# EA will convert between keys

# ====== CHATGPT API ====================
# Layout: https://platform.openai.com/api-keys
# OPENAI - CO PHI ($5 minimum)
# If you sell $50, you can create multiple keys

CHATGPT=sk-abc123xyz456key1...
CHATGPT=sk-abc123xyz456key2...

# Use OPENAI name:
# OPENAI=sk-abc123xyz456key3...

# EA will transfer keys when:
# - Het credits
# - Rate limit
# - Loi server

# ==================== CLAUDE API ====================
# Download: https://console.anthropic.com/
# ANTHROPIC - PAID ($5-$100)
# Create multiple keys to divide quotas

CLAUDE=sk-ant-abc123xyz456key1...
CLAUDE=sk-ant-abc123xyz456key2...

# Or use the name ANTHROPIC:

# ANTHROPIC=sk-ant-abc123xyz456key3...

# ============================================================
# PRACTICAL EXAMPLE:

# ============================================================

# Case 1: You have 3 Groq accounts (free)
# GROQ=gsk_key_from_account1
# GROQ=gsk_key_from_account2
# GROQ=gsk_key_from_account3

# Case 2: You deposit $100 into OpenAI, divided into 4 keys
# CHATGPT=sk_key1_25dollar
# CHATGPT=sk_key2_25dollar
# CHATGPT=sk_key3_25dollar
# CHATGPT=sk_key4_25dollar
# => When key1 gets $25, convert key2

# Case 3: Connecting multiple providers
# GROQ=gsk_key1
# GROQ=gsk_key2
# GEMINI=AIza_key1
# CHATGPT=sk_key1
# => EA collects all keys of Primary AI first,
# then switch to another provider

# ==========================================================================
# IMPORTANT LAW:
# ==========================================================================

# 1. SO LUONG KEY:
# - Groq (free): Necessary 3-5 keys
# - Gemini (free): Should have 2-3 keys
# - ChatGPT (fee): Regardless of budget, need to be divided
# - Claude (paid): Depending on budget, divide it into smaller parts.

# 2. USAGE STRATEGY:

# - Set Primary AI = GROQ (free)

# - Fallback to Gemini (free)

# - Only use ChatGPT/Claude (paid) as the last step

# => Maximize cost savings!

# 3. MONITORING CREDIT:

# - Check the MT5 Journal

# - EA will notify you when transferring keys

# - If all keys are faulty => transfer to another provider

# 4. SECURITY:

# - DO NOT share this file

# - DO NOT upload to the internet

# - Change keys periodically

# ============================================================
# HANDLING ERRORS:

# ============================================================

# EA automatically handles the following errors:

# ✓ Key credit expires => Transfer to the next key

# ✓ Rate limit (too many requests) => Transfer to another key

# ✓ Invalid key => Skip, try another key
# ✓ Server error => Try again with a different key

# ✓ Timeout => Transfer to another key/provider

# ============================================================
# OPTIMAL CONFIGURATION (RECOMMENDED):

# ============================================================

# $0 BUDGET (COMPLETELY FREE):
# Create 5 Groq accounts + 3 Gemini accounts
# GROQ=key1
# GROQ=key2
# GROQ=key3
# GROQ=key4
# GROQ=key5
# GEMINI=key1
# GEMINI=key2
# GEMINI=key3

# $20-50 BUDGET:

# Create 3 Groq + 2 Gemini + 2 ChatGPT keys
# GROQ=key1
# GROQ=key2
# GROQ=key3
# GEMINI=key1
# GEMINI=key2
# CHATGPT=key1 (deposit $10)
# CHATGPT=key2 (deposit $10)

# $100+ BUDGET:

# Create all providers
# GROQ=key1
# GROQ=key2
# GEMINI=key1
# GEMINI=key2
# CHATGPT=key1 (nap $25)
# CHATGPT=key2 (nap $25)
# CLAUDE=key1 (nap $25)
# CLAUDE=key2 (nap $25)

# ==========================================================================
# KET THUC FILE QUICKLY
# Replace the values ​​...key1, ...key2 with that API key!
# ==========================================================================
Version 7.0 2026.01.06
1. ATR - Adaptive SL/TP/Trailing

UseAdaptiveATR = true - SL/TP/Trail automatically adjusts according to volatility
ATRMultiplierSL = 1.5 - SL = ATR × 1.5
ATRMultiplierTP = 2.5 - TP = ATR × 2.5
ATRMultiplierTrail = 0.5 - Trail step = ATR × 0.5

2. Risk-Reward Filter

MinRiskRewardRatio = 1.5 - Only enter trades when RR ≥ 1.5
Automatically adjust TP if RR is insufficient
Reject trade if minimum RR cannot be reached

3. Momentum Confirmation

UseMomentumConfirmation = true - Requires momentum confirmation
MomentumATRThreshold = 0.3 - Price move ≥ 30% ATR before entry

4. Spread Buffer

UseSpreadBuffer = true - Add buffer spread into SL/TP
SpreadMultiplier = 2.0 - Buffer = Spread × 2

5. Equity Curve Position Sizing

UseEquityCurveFilter = true - Increase/decrease lots according to the equity curve
WinStreakLotBonus = 0.2 - +20% lot per winning streak
LoseStreakLotPenalty = 0.3 - -30% lot per losing streak

6. AI Overconfidence Protection

AIMaxConfidenceCheck = 95 - Reduce lot if AI > 95% confident

7. Improved AI Prompt

Requires AI to output RR ratio
Emphasize minimum RR in the decision framework