Jocimar Lopes / Профиль
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.
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.
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.
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.
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.
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.
This article describes a simple but comprehensive statistical arbitrage pipeline for trading a basket of cointegrated stocks. It includes a fully functional Python script for data download and storage; correlation, cointegration, and stationarity tests, along with a sample Metatrader 5 Service implementation for database updating, and the respective Expert Advisor. Some design choices are documented here for reference and for helping in the experiment replication.
This article presents a sample MQL5 Service implementation for updating a newly created database used as source for data analysis and for trading a basket of cointegrated stocks. The rationale behind the database design is explained in detail and the data dictionary is documented for reference. MQL5 and Python scripts are provided for the database creation, schema initialization, and market data insertion.
This article presents a sample Expert Advisor implementation for trading a basket of four Nasdaq stocks. The stocks were initially filtered based on Pearson correlation tests. The filtered group was then tested for cointegration with Johansen tests. Finally, the cointegrated spread was tested for stationarity with the ADF and KPSS tests. Here we will see some notes about this process and the results of the backtests after a small optimization.
This article aims to provide a trader-friendly, gentle introduction to the most common cointegration tests, along with a simple guide to understanding their results. The Engle-Granger and Johansen cointegration tests can reveal statistically significant pairs or groups of assets that share long-term dynamics. The Johansen test is especially useful for portfolios with three or more assets, as it calculates the strength of cointegrating vectors all at once.
Эта статья описывает фундаментальные основы статистического арбитража на уровне портфеля. Ее цель — облегчить понимание принципов статистического арбитража читателям, не обладающим глубокими математическими познаниями, и предложить отправную концептуальную конструкцию. Статья включает в себя работающего экспертного советника, некоторые заметки о его тестировании на исторических данных в пределах одного года, а также соответствующие настройки конфигурации тестирования на исторических данных (файл .ini) для воспроизведения эксперимента.
Статья является последней частью серии, описывающей этапы разработки нативного MQL5-клиента для протокола MQTT 5.0. Хотя библиотека еще не готова к использованию, в этой части мы будем использовать наш клиент для обновления пользовательского символа с помощью тиков (или цен), полученных от другого брокера. В конце статьи вы найдете дополнительную информацию о текущем состоянии библиотеки и узнаете о том, чего не хватает для ее полного соответствия протоколу MQTT 5.0, о возможном плане действий и о том, как следить за развитием библиотеки и вносить в нее свой вклад.
Статья является шестой частью серии, описывающей этапы разработки нативного MQL5-клиента для протокола MQTT 5.0. В этой части я опишу основные изменения в нашем первом рефакторинге, получение рабочего проекта наших классов построения пакетов, создание пакетов PUBLISH и PUBACK, а также семантику кодов причин PUBACK.
Статья является пятой частью серии, описывающей этапы разработки нативного MQL5-клиента для протокола MQTT 5.0. В этой части мы опишем структуру пакетов PUBLISH - как мы устанавливаем их флаги публикации (Publish Flags), кодируем строки названий тем и устанавливаем идентификаторы пакетов, когда это необходимо.
Статья является четвертой частью серии, описывающей этапы разработки нативного MQL5-клиента для протокола MQTT. В этой части мы рассматриваем свойства MQTT v5.0, их семантику, то, как мы читаем некоторые из них, а также приводим краткий пример того, как свойства можно использовать для расширения протокола.
Статья является третьей частью серии, описывающей этапы разработки нативного MQL5-клиента для протокола MQTT. В этой части мы подробно описываем применение принципа разработки через тестирование для реализации обмена пакетами CONNECT/CONNACK. В конце этого шага наш клиент ДОЛЖЕН уметь вести себя соответствующим образом при работе с любыми возможными результатами сервера при попытке подключения.
Статья является частью серии, описывающей этапы разработки нативного MQL5-клиента для протокола MQTT. В этой части мы описываем организацию нашего кода, первые заголовочные файлы и классы, а также написание тестов. В эту статью также включены краткие заметки о разработке через тестирование (Test-Driven-Development) и о ее применении в этом проекте.
Статья представляет собой первую попытку разработать нативный MQTT-клиент для MQL5. MQTT - это протокол обмена данными по принципу "издатель - подписчик". Он легкий, открытый, простой и разработан так, чтобы его было легко внедрить. Это позволяет применять его во многих ситуациях.
В статье описываются четыре метода подключения кода MQL5 к базе данных Postgres и предоставляется пошаговое руководство по настройке среды разработки для одного из них, REST API, с использованием подсистемы Windows для Linux (WSL). Показано демонстрационное приложение для API с соответствующим кодом MQL5 для вставки данных и запросов к соответствующим таблицам, а также демонстрационный советник для использования этих данных.