Jocimar Lopes
Jocimar Lopes
developer 在 free worker
Jocimar Lopes
已发布文章Low-Frequency Quantitative Strategies in MetaTrader 5 (Part 6): A Constant-Dollar Exposure FX Trading System Based on Fixed-Income Interest Rate Yield Differentials
Low-Frequency Quantitative Strategies in MetaTrader 5 (Part 6): A Constant-Dollar Exposure FX Trading System Based on Fixed-Income Interest Rate Yield Differentials

We describe ANANTA, a rules-based FX portfolio model that measures deviations in Interest Rate Swap differentials via moving averages and rebalances constant-dollar exposure across G10 currencies. Designed for intraday operation, it complements or substitutes carry logic without relying on trade volume. Performance is examined from January 2020 to October 2026 for five of the most liquid currencies. Code and free data pipelines are included.

Jocimar Lopes
已发布文章Low-Frequency Quantitative Strategies in MetaTrader 5 (Part 5): Pre-Backtest Evaluation of Machine-Learning-Generated Signals Through Formulaic Alphas
Low-Frequency Quantitative Strategies in MetaTrader 5 (Part 5): Pre-Backtest Evaluation of Machine-Learning-Generated Signals Through Formulaic Alphas

The article shows how to evaluate machine-learning alphas before a full backtest by expressing them as formulaic alphas. We compute Information Coefficient (IC), Rank IC, Information Ratio (ICIR), and t-statistics to quantify forecasting strength and stability. A MetaTrader 5 backtest illustrates differences versus execution-dependent tests, and a Python parser facilitates reproducible calculations and bulk screening.

Jocimar Lopes
已发布文章Low-Frequency Quantitative Strategies in MetaTrader 5 (Part 4): A Volatility-Adjusted Momentum-Based Intraday System
Low-Frequency Quantitative Strategies in MetaTrader 5 (Part 4): A Volatility-Adjusted Momentum-Based Intraday System

We present a timer-based MQL5 EA for Opening Range Breakout aligned to NYSE hours. It screens “Stocks in Play” via opening-range relative volume, enforces price/volume/ATR minimums, sizes positions by risk, and exits at 16:00 ET. A Sharpe-ranked optimization across 30 liquid Nasdaq stocks and a single-symbol test are provided, together with backtest settings and an Excel report for verification.

Jocimar Lopes
已发布文章Low-Frequency Quantitative Strategies in MetaTrader 5 (Part 3): A Regime-Adaptive Mean-Reversion Swing Trading System
Low-Frequency Quantitative Strategies in MetaTrader 5 (Part 3): A Regime-Adaptive Mean-Reversion Swing Trading System

The article describes and codes MR Swing in MQL5, a mean‑reversion swing approach that combines a 200‑day hysteresis channel with Value Charts, DVO, and SVAPO. We document entry/exit rules for bull and bear regimes and show five‑year backtests on six high‑liquidity Nasdaq stocks. The complete EA code and backtest configurations are provided for reproducibility.

Jocimar Lopes
已发布文章Low-Frequency Quantitative Strategies in Metatrader 5: (Part 2) Backtesting a Lead/Lag Analysis in SQL and in Metatrader 5
Low-Frequency Quantitative Strategies in Metatrader 5: (Part 2) Backtesting a Lead/Lag Analysis in SQL and in Metatrader 5

The article describes a complete pipeline that uses data analysis for finding low-frequency lead/lag trading opportunities. It goes into building a cross-correlation-based Lead/Lag analyser step-by-step, with special attention to the most common errors beginners may commit while developing cross-asset diffusion queries. After screening dozens of cointegrated and correlated pairs, a trading candidate pair is chosen, and its tradeability is evaluated in a pure SQL backtest. Once it is qualified, the strategy is backtested on the MetaTester for parameter optimization. The Expert Advisor with respective backtest settings and optimization inputs is provided, along with Python and SQL scripts.

1
Jocimar Lopes
已发布文章Low-Frequency Quantitative Strategies in Metatrader 5: (Part 1) Setting Up An OLAP-Friendly Data Store
Low-Frequency Quantitative Strategies in Metatrader 5: (Part 1) Setting Up An OLAP-Friendly Data Store

The article outlines a practical data pipeline for quantitative analysis based on Parquet storage, Hive-style partitions, and DuckDB. It details migrating selected SQLite tables to Parquet, structuring market data by source, symbol, timeframe, and date, and querying it with SQL window functions. A Golden Cross example illustrates cross‑symbol evaluation of forward returns. Accompanying Python scripts handle data download, conversion, and execution.

1
Jocimar Lopes
已发布文章Statistical Arbitrage Through Cointegrated Stocks (Final): Data Analysis with Specialized Database
Statistical Arbitrage Through Cointegrated Stocks (Final): Data Analysis with Specialized Database

The article shows how to pair SQLite (OLTP) with DuckDB (OLAP) for statistical arbitrage data processing. DuckDB’s columnar engine, ASOF JOIN, and array functions accelerate core tasks such as quote–trade alignment and RWEC, with measured speedups from 2x to 23x versus SQLite on larger inputs. You get simpler queries and faster analytics while keeping trade execution in SQLite.

1
Jocimar Lopes
已发布文章Statistical Arbitrage Through Cointegrated Stocks (Part 10): Detecting Structural Breaks
Statistical Arbitrage Through Cointegrated Stocks (Part 10): Detecting Structural Breaks

This article presents the Chow test for detecting structural breaks in pair relationships and the application of the Cumulative Sum of Squares - CUSUM - for structural breaks monitoring and early detection. The article uses the Nvidia/Intel partnership announcement and the US Gov foreign trade tariff announcement as examples of slope inversion and intercept shift, respectively. Python scripts for all the tests are provided.

1
Jocimar Lopes
已发布文章Statistical Arbitrage Through Cointegrated Stocks (Part 9): Backtesting Portfolio Weights Updates
Statistical Arbitrage Through Cointegrated Stocks (Part 9): Backtesting Portfolio Weights Updates

This article describes the use of CSV files for backtesting portfolio weights updates in a mean-reversion-based strategy that uses statistical arbitrage through cointegrated stocks. It goes from feeding the database with the results of a Rolling Windows Eigenvector Comparison (RWEC) to comparing the backtest reports. In the meantime, the article details the role of each RWEC parameter and its impact in the overall backtest result, showing how the comparison of the relative drawdown can help us to further improve those parameters.

Jocimar Lopes
已发布文章Statistical Arbitrage Through Cointegrated Stocks (Part 8): Rolling Windows Eigenvector Comparison for Portfolio Rebalancing
Statistical Arbitrage Through Cointegrated Stocks (Part 8): Rolling Windows Eigenvector Comparison for Portfolio Rebalancing

This article proposes using Rolling Windows Eigenvector Comparison for early imbalance diagnostics and portfolio rebalancing in a mean-reversion statistical arbitrage strategy based on cointegrated stocks. It contrasts this technique with traditional In-Sample/Out-of-Sample ADF validation, showing that eigenvector shifts can signal the need for rebalancing even when IS/OOS ADF still indicates a stationary spread. While the method is intended mainly for live trading monitoring, the article concludes that eigenvector comparison could also be integrated into the scoring system—though its actual contribution to performance remains to be tested.

2
Chacha Ian Maroa
Chacha Ian Maroa 2025.12.05
Great article
Jocimar Lopes
已发布文章Statistical Arbitrage Through Cointegrated Stocks (Part 7): Scoring System 2
Statistical Arbitrage Through Cointegrated Stocks (Part 7): Scoring System 2

This article describes two additional scoring criteria used for selection of baskets of stocks to be traded in mean-reversion strategies, more specifically, in cointegration based statistical arbitrage. It complements a previous article where liquidity and strength of the cointegration vectors were presented, along with the strategic criteria of timeframe and lookback period, by including the stability of the cointegration vectors and the time to mean reversion (half-time). The article includes the commented results of a backtest with the new filters applied and the files required for its reproduction are also provided.

3
Jocimar Lopes
已发布文章Statistical Arbitrage Through Cointegrated Stocks (Part 6): Scoring System
Statistical Arbitrage Through Cointegrated Stocks (Part 6): Scoring System

In this article, we propose a scoring system for mean-reversion strategies based on statistical arbitrage of cointegrated stocks. The article suggests criteria that go from liquidity and transaction costs to the number of cointegration ranks and time to mean-reversion, while taking into account the strategic criteria of data frequency (timeframe) and the lookback period for cointegration tests, which are evaluated before the score ranking properly. The files required for the reproduction of the backtest are provided, and their results are commented on as well.

3
Jocimar Lopes
已发布文章Statistical Arbitrage Through Cointegrated Stocks (Part 5): Screening
Statistical Arbitrage Through Cointegrated Stocks (Part 5): Screening

This article proposes an asset screening process for a statistical arbitrage trading strategy through cointegrated stocks. The system starts with the regular filtering by economic factors, like asset sector and industry, and finishes with a list of criteria for a scoring system. For each statistical test used in the screening, a respective Python class was developed: Pearson correlation, Engle-Granger cointegration, Johansen cointegration, and ADF/KPSS stationarity. These Python classes are provided along with a personal note from the author about the use of AI assistants for software development.

3
Jocimar Lopes
已发布文章通过协整股票进行统计套利(第四部分):实时模型更新
通过协整股票进行统计套利(第四部分):实时模型更新

本文介绍了一条简单而全面的统计套利流水线,用于交易一篮子协整股票。 文中提供了一个功能齐全的 Python 脚本,用于下载和存储数据,以及进行相关性、协整和平稳性检验;还提供了用于更新数据库的 MetaTrader 5 服务程序实现示例及相应的智能交易系统(EA)。 本文记录了一些设计选择,供读者参考,并帮助读者复现实验。

Jocimar Lopes
已发布文章基于协整股票的统计套利(第三部分):数据库搭建
基于协整股票的统计套利(第三部分):数据库搭建

本文提供一个 MQL5 Service(服务)的实现示例,用于保持新建数据库及时更新;该数据库作为数据分析以及一篮子协整股票交易的数据来源。文中详细阐述数据库的设计思路,并整理数据字典以供查阅。配套提供MQL5与Python脚本,用于数据库创建、表结构初始化以及行情数据写入。

Jocimar Lopes
已发布文章基于协整股票的统计套利(第二部分):EA、回测与优化
基于协整股票的统计套利(第二部分):EA、回测与优化

本文展示一个智能交易系统(EA)示例,用于交易一篮子四只纳斯达克股票。选股流程如下:首先通过皮尔逊相关系数检验进行初步筛选;再对筛选后的股票组进行约翰森协整检验;最后通过ADF检验与KPSS检验验证协整价差的平稳性。本文将对这一流程做补充说明,并展示经过小幅优化后的回测结果。

Jocimar Lopes
已发布文章通过协整股票实现统计套利(第一部分):恩格尔 - 格兰杰检验与约翰森协整检验
通过协整股票实现统计套利(第一部分):恩格尔 - 格兰杰检验与约翰森协整检验

本文旨在以适合交易者且通俗易懂的方式,介绍最常用的协整检验方法,并附带一份解读检验结果的简易指南。恩格尔 - 格兰杰检验与约翰森协整检验,能够识别出具备长期联动关系、且在统计上显著的资产配对或资产组合。约翰森检验尤其适用于包含三种及以上资产的投资组合,因其可一次性测算出所有协整向量的强度。

Jocimar Lopes
已发布文章通过配对交易中的均值回归进行统计套利:用数学战胜市场
通过配对交易中的均值回归进行统计套利:用数学战胜市场

本文描述了投资组合层面的统计套利基础知识。其目标是帮助没有深厚数学知识的读者理解统计套利的原则,并提出一个概念性的起点框架。文章包含一个可运行的智能交易系统(EA)、一些关于其一年回测的笔记,以及用于复现实验的相应回测配置设置(.ini 文件)。

· 2 2193
Ishtiaq Ahmad
Ishtiaq Ahmad 2025.04.11
Mystery solved. 😊😊😊
Jocimar Lopes
已发布文章为 MetaTrader 5 开发 MQTT 客户端:TDD 方法 - 最终篇
为 MetaTrader 5 开发 MQTT 客户端:TDD 方法 - 最终篇

本文是介绍我们针对 MQTT 5.0 协议的本机 MQL5 客户端的开发步骤系列文章的最后一部分。尽管该库尚未投入实际使用,但在此部分中,我们将使用我们的客户端来更新来自另一个经纪商的报价(或利率)的自定义交易品种。请参阅本文底部以获取有关该库的当前状态的更多信息、它与 MQTT 5.0 协议完全兼容所缺少的内容、可能的路线图以及如何关注和促进其发展。

Jocimar Lopes
已发布文章为 Metatrader 5 开发 MQTT 客户端:TDD 方法 - 第 6 部分
为 Metatrader 5 开发 MQTT 客户端:TDD 方法 - 第 6 部分

本文是介绍我们针对 MQTT 5.0 协议的本地 MQL5 客户端的开发步骤的系列文章的第六部分。在本部分中,我们会讨论我们第一次重构中的主要变化,我们如何为我们的数据包构建类得出可行的蓝图,我们如何构建 PUBLISH 和 PUBACK 数据包,以及 PUBACK 原因代码背后的语义。

12