Caicai Long and Short Pair Trading
- Experts
-
Thiago Lopes
Hello! I'm Caicai, a developer and trader focused on creating high-performance Expert Advisors (EAs) for MetaTrader 5. My expertise lies in transforming complex trading logic into 100% automated systems using MQL5 and Pine Script.
Core Competencies: - Version: 9.1
- Mise à jour: 25 mai 2026
- Activations: 20
CaicaiLS Pro is an institutional-grade quantitative Expert Advisor designed for Long & Short (Pair Trading) operations using Statistical Arbitrage. Developed for demanding traders, it tracks correlation and cointegration anomalies across multiple asset pairs simultaneously, seeking profit in both mean reversion and breakout trends (Momentum).
Its architecture has evolved to a definitive level with the introduction of Shadow Execution. The mathematical cycle now runs 100% in an invisible virtual engine, while the real account acts only as an on-demand "mirror". It operates with excellence in Stocks, REITs (FIIs), and B3 Futures (like WDO, WIN, DI1), as well as Forex, Cryptocurrencies, and Global Indices (US30, US500). The EA features an expanded interactive on-chart panel with 6 analytical tabs, offering surgical control and real-time institutional telemetry of your entire portfolio.
🔥 What's New in Version 9.0 Pro? (Shadow Engine + Target Scoping)
- 🧠 Universal "Shadow Execution" Engine: The heart of the EA now processes risk and mathematics in a continuous virtual environment. MAE/MFE tracking and cycle P/L no longer suffer interference or the "observer effect" if the broker closes an order. The model runs pure and undisturbed.
- 🎛️ Individual On-Chart LIVE Control: Enable or disable real-account mirroring instantly via the panel using the new "ON/OFF" button. The EA features state persistence (remembers your choices via Global Variables), allowing you to test the model running in the background (Shadow) before exposing real capital.
- 🎯 Multidimensional Target Scope: A tactical innovation that lets you choose whether hitting a Take Profit/Stop Loss (Global or per Pair) should close only the operation on the real account—leaving the phantom engine running and learning—or fully reset the mathematical cycle.
- ⛔ Maximum Financial Spread Filter ($): Besides filtering spreads by points or ticks, V9.0 introduces Max Spread Money. The EA converts the current spread into a financial value for the minimum lot and blocks the entry if the real brokerage cost makes the statistical profit unviable.
- 🛡️ "Quarantine" Mode in Smart Single Leg: The single-leg intelligence has been significantly enhanced. If the recent history (Rolling Window) reveals that both legs (Y and X) have a negative P/L, the EA enters a quarantine mode, suspending real execution until a directional inefficiency proves profitable again in the Shadow Engine.
- 📊 Expanded Institutional Dashboard (6 Tabs): The High-Tech interface has been massively expanded:
1. Overview: Macro view of the mathematics (Z-Score, Hurst, ADF).
2. Shadow Legs: X-ray of the virtual engine (Volume, Price, and simulated P/L).
3. Telemetry $: Deep analysis of financial MAE/MFE.
4. Telemetry %: Efficiency of each leg and the pair in percentage.
5. Real vs Shadow: The system's Alpha: compare real profit versus the simulated profit.
6. Real Results: Automated report of Daily, Weekly, Monthly, Total P/L, and the account's Mathematical Expectancy.
🌟 Key Highlights and Features
- 📈 Advanced Mathematical Models: Choose between the Logarithmic OLS (Ordinary Least Squares) model or Ratio with Bollinger Bands to calculate the Z-Score and pair dispersion.
- 🧠 Elite Quantitative Filters: Native integration with the Augmented Dickey-Fuller (ADF) Test to validate real stationarity and Hurst Exponent to confirm the market regime, avoiding false breakouts. Also includes filters for Volatility (ATR), Exhaustion (Spread RSI), and Kurtosis (avoids trading in "fat tails").
- 🛡️ Dynamic Risk Management: Multi-layered capital protection: Stop Loss by financial value, account percentage, or Z-Score limit. Auto-Yield to adapt to real distortion variations, dynamic lot management based on volatility contraction, auto-close by time (Day Trade), and global daily Gain/Loss targets.
- ⚖️ Smart Position Sizing & Auto-Hedge: Configurable balancing in Cash Neutral or Beta Neutral. Features an automatic lot scaling system to correct broker rounding errors (Tick Size / Lot Step) and ensure a perfect hedge.
- 📊 Limited Grid and Smart Scaling In: Up to 3 dynamic re-entry levels per pair, with progressive Z-Score triggers, protected by a Minimum Grid Distance filter.
- 🔄 Auto-Rollover and Full Recovery: Futures Contracts rollover (B3) by merging the asset root. All virtual legs, button states, and telemetry are saved in high-speed binary files. The EA instantly recovers its state after a VPS reboot or MetaTrader restart.
📌 Recommendations and Markets
- 🌍 Asset Universality: The math behind statistical arbitrage is universal. Run it in any market with liquidity and cointegration:
• Forex & Crypto: EURUSD, GBPUSD, USDJPY, BTCUSD, SOLUSD, etc.
• Global Indices: US30 (Dow), US500 (S&P 500), DE40 (DAX), etc.
•🪙 Risk-Free Validation (Incubator): Take advantage of the "Shadow Legs" tab to test huge portfolios in a real environment with the "LIVE" button turned off. Evaluate the generated Alpha in the statistics and activate real orders only on pairs that prove profitability in the short/medium term. Ideal for optimizing Cent or fractional accounts.
•⏱️ Timeframe: Adaptable to any timeframe, provided it is supported by MTF analysis or prior cointegration tests.

