Discussing the article: "Hjorth Parameters for MQL5: Activity, Mobility, and Complexity as a Volatility-Momentum-Shape Dashboard"

Check out the new article: Hjorth Parameters for MQL5: Activity, Mobility, and Complexity as a Volatility-Momentum-Shape Dashboard.

Implements Hjorth's Activity, Mobility and Complexity in MQL5 as an O(1) rolling engine, a regime-colored dashboard indicator, and an Expert Advisor. Explains how volatility, lag-1 autocorrelation and path shape arise from three variances, how null bands classify regimes, and how the indicator feeds the EA. Tests a Donchian breakout with and without a Trend gate on real ticks, with checks and limitations

Most dashboards stack unrelated indicators: an ATR for volatility, a slope for momentum, a choppiness index for shape. In 1970 Bo Hjorth described EEG traces with three numbers from one calculation, the variances of a signal and of its first and second differences. He called them Activity, Mobility and Complexity.

On price returns, Activity is volatility, Mobility encodes the lag-1 autocorrelation of returns, and Complexity measures how irregular the path is. Here they are implemented natively in MQL5: an O(1) rolling engine, a regime-colored dashboard, and an EA that uses the dashboard to filter a Donchian breakout. The filter is then tested on three symbols and two timeframes with real ticks.

Let y[t] be the log return of bar t, Δy its first difference and Δ²y its second. Each variance uses the same N bars, t − N + 1 to t, with the mean removed and an (N − 1) denominator:

N is the number of values in each variance. Δ²y at the oldest bar needs two earlier returns, so one window spans N + 2 returns and N + 3 closes (i.e., 102 returns and 103 closes when N = 100). The null band uses this N.

The input is returns, because a price window's variance mostly measures how far the trend traveled. For a stationary series:

This is a population-level identity. On a 100-bar window, 1 − M²/2 is only an estimate of ρ₁. It also assumes stationarity, which trading data only approximates. Mobility below √2 points to returns that continue, above √2 to returns that reverse.

Fig. 1. Autocorrelation implied by Mobility against the true AR(1) coefficient

True φ on the horizontal axis, 1 − M²/2 from one 100-return window on the vertical. 400 simulated windows for each of 21 values of φ; dots show 60 of them, the band spans the 5th to 95th percentile, the solid line is the median, the dashed line is the identity. The dotted lines at ±0.15 are the classifier's two one-sided cut-offs: above for Trend, below for Revert.

Author: Adewumi Babatunde Gbadebo