1.9 KiB
NetworkMomentum
A research paper's network-momentum trend-following strategy, implemented entirely in MQL5.
Companion code for the MQL5 article: https://www.mql5.com/en/articles/23763
What it does
Momentum does not stay inside one market. If A reliably leads B, then A's trend carries information about B's next move. The strategy trades that spillover.
Three pieces make it work. Derivative Dynamic Time Warping detects lead-lag relationships between markets, comparing shapes rather than levels. A convex optimisation then learns a weighted graph from those relationships, so the network is fitted rather than hand-drawn. Momentum is propagated across that graph and turned into a signal.
Returns are volatility-scaled before any of this, so a loud market does not dominate the network for the wrong reason.
NM_Native.mq5 is the Expert Advisor. The article covers the Strategy Tester
results, including where the approach struggles.
Layout
Include/NetworkMomentum/NM_Config.mqh configuration
Include/NetworkMomentum/NM_Matrix.mqh matrix helpers
Include/NetworkMomentum/NM_Data.mqh multi-symbol data handling
Include/NetworkMomentum/NM_Symbols.mqh the basket
Include/NetworkMomentum/NM_Momentum.mqh volatility scaling and oscillators
Include/NetworkMomentum/NM_DDTW.mqh derivative dynamic time warping
Include/NetworkMomentum/NM_GraphLearner.mqh convex graph learning
Include/NetworkMomentum/NM_Engine.mqh ensemble, propagation, signal
Include/NetworkMomentum/NM_Live.mqh chart-side layer
Experts/NetworkMomentum/NM_Native.mq5 the Expert Advisor
Put every basket symbol in Market Watch before running, since the EA pulls history for all of them.
Disclaimer
Educational code. Past behaviour of any model or dataset says nothing about future results. Test on your own data and broker conditions before drawing conclusions.