Discussing the article: "Self-Exciting Markets: Building a Hawkes Process from Scratch"

 

Check out the new article: Self-Exciting Markets: Building a Hawkes Process from Scratch.

Volatility arrives in clusters: one large move makes the next large move more likely, and quiet spells stay quiet. This article builds a Hawkes self-exciting point process in pure MQL5 to measure that effect directly, ending in a single number, the branching ratio, that says how reflexive a market currently is. You get a small, tested library, an indicator that plots the fitted intensity live, and a demonstration Expert Advisor, along with the honest limits of all three.

Every trader has seen it. A market drifts sideways for days, then a single sharp move breaks the calm, and suddenly the moves come one after another. The tape gets loud, then stays loud, then slowly settles. This is volatility clustering, and it is one of the most robust facts about financial time series.

The usual MQL5 answer to clustering is a GARCH-style volatility model. GARCH describes the size of returns and how their variance persists. It is a good tool, but it answers a different question from the one this article asks. GARCH models the amplitude of a continuous process. A Hawkes process models the timing of events: it treats large moves as discrete arrivals in time and asks whether one arrival raises the probability of the next.

That shift of viewpoint buys a single, interpretable quantity. The Hawkes branching ratio, written n, is the expected number of follow-on events each event triggers. When n is near zero the events are independent, arriving like raindrops with no memory. When n approaches one the process is close to feeding on itself, each move breeding more moves, a market that is endogenously driven rather than reacting to outside news. Economists call this property reflexivity, and n measures it on a scale from zero to one.

A search of the MQL5 article catalog turns up GARCH and its relatives, but no Hawkes process. So this is built from scratch: an event extractor, an exponential-kernel intensity, a maximum-likelihood fitter, and the branching ratio on top. The code is the deliverable, and it is tested to the point where its numbers can be trusted; this validation was done before a single line of the article was written.


Author: Hammad Dilber