The Inferential Speculator

By D. Thomakos

In the realm of systematic trading, the pursuit of robust, interpretable, and adaptive models remains a central challenge. Amidst a sea of opaque machine learning algorithms and simplistic technical indicators, the Cox Probabilistic Trading System offers a refreshing alternative: a mathematically grounded, probabilistic framework that combines Bayesian reasoning, entropy-based risk management, and rigorous validation techniques like Walk-Forward Optimization (WFO).

At its core, the Cox system maintains a dynamic belief about the market's direction based on observable features extracted from historical price data. This belief is represented as a probability [math] P(M) [/math], where [math] M [/math] denotes a bullish market state.As new market data arrives, features such as momentum, Sharpe ratio, and utility are computed over rolling windows. These features are discretized to define the market state and used to generate evidence [math] E [/math]. Bayesian updating refines the market belief:

[math] P(M|E) = \frac{P(E|M) \times P(M)}{P(E|M) \times P(M) + P(E|\neg M) \times (1 - P(M))} [/math]

Here, [math] P(E|M) [/math] represents the likelihood of observing the evidence under a bullish market state, and [math] P(M|E) [/math] becomes our updated belief. Trading decisions should not only depend on the estimated probability but also on the confidence of that estimate. The Cox system leverages Shannon entropy to quantify uncertainty:

[math] H(p) = -p \log_2(p) - (1 - p) \log_2(1 - p) [/math]

Low entropy signals high confidence, allowing the system to execute trades only when uncertainty is sufficiently low.

I considered two distinct implementations of this trading system:

Version 1: Adaptive Feature Relevance

1. Employs a flexible feature system with conditional entropy analysis.

2. Dynamically adjusts feature importance based on observed market behavior.

3, Ideal for complex, feature-rich environments.

Version 2: Simplified Binary Features

1. Utilizes fixed thresholds for momentum, Sharpe ratio, and utility.

2. Market state is encoded as a concise binary string.

3. Emphasizes computational efficiency and interpretability.

Both versions incorporate entropy-based risk management, adjusting position sizing based on observed covariance between entropy and portfolio performance.

To ensure realistic, out-of-sample performance, the Cox system employs Walk-Forward Optimization (WFO). This robust procedure mimics real-time deployment as (a) Historical data is divided into sequential training and testing windows, (b) Model parameters are optimized on the training set, (c) Out-of-sample performance is evaluated on the test set, (d) The window rolls forward, and the process repeats. This approach provides an honest assessment of robustness and helps prevent overfitting to historical noise.

The system's core features are computed as using momentum, the Sharpe ratio and mean variance utility (this is the second, simplified and robust, version, please consult the Python files at my github repository for the full information and implementation - there is more there than meets the eye here). After their computation they are transformed to probabilities and market states. Please note that the first version has enormous flexibility in using any kind of features to construct the rules for inference - you should really see the code! Rather than rigid stop-losses or static position sizing, the Cox system adjusts exposure based on the covariance between entropy and portfolio returns. This dynamic mechanism penalizes high-confidence scenarios that historically underperform. Again, consult the code for more details!

The Cox system draws inspiration from the work of Richard Threlkeld Cox (1898–1991), an American physicist and mathematician renowned for formalizing the logical foundations of probability theory. Cox is best known for his influential book, The Algebra of Probable Inference (1961), in which he derived the rules of probability as a consistent extension of logic. In this seminal work, Cox demonstrated that any system for plausible reasoning, if it satisfies certain basic consistency requirements, must follow the same algebra as standard probability theory. His contributions provided a rigorous justification for using probabilities to represent uncertain beliefs—a principle that lies at the heart of the Cox Probabilistic Trading System.

The Cox Probabilistic Trading System illustrates that modern trading models can be both mathematically principled and practically robust. By blending Bayesian inference, information theory, and rigorous validation, it offers a viable pathway for traders and researchers seeking systematic, interpretable, and adaptable trading strategies.In a financial landscape dominated by black-box models and hindsight bias, the Cox system stands as a transparent, probabilistically grounded alternative—reminding us that in markets, as in science, uncertainty is not the enemy, but the guide. Read the technical summary below, get your hands on the code and explore the beauty of probabilistic decision making. 

Technical summary