You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Graph Theory: Study of Graphs Generated by Some Random Process.
This article describes an MQL5 Expert Advisor that models the market as a random graph rather than a fixed structure. Bars are encoded into discrete states; bar-to-bar moves form a decaying, Laplace-smoothed transition matrix, and a k-step random walk yields a bounded directional signal gated by an Erdos–Renyi null-model test. A separate trade-outcome graph over R-milestones learns survival probabilities to manage exits, turning position management into evidence-based rules.
Most trading systems we build carry a hidden assumption. They assume the market has one fixed structure, and that our job is to find it. A moving average crossover assumes trends behave the same way every month. A support and resistance rule assumes a level means the same thing in January and in September. Even the graph algorithms we have already covered in this series, such as Dijkstra, breadth-first search, and A*, work on a graph whose edges are known and stable before the search begins. The trader then spends months tuning parameters, because the fixed map keeps drifting away from the territory. The strategy works for a while, then quietly stops working, and nobody can say exactly when the change happened.
Adaptive models come in many forms, and random graph theory is one of them. It offers a different starting point. Instead of assuming the graph is given, we assume the graph is generated by a random process that we can only observe. Vertices are still market objects, but edges appear and disappear with probabilities that we estimate from data. The network is allowed to rewire itself as the market changes. This is a closer fit to non-stationary markets than a frozen map, although whether it produces a trading edge is something we must test rather than assume. It also gives us something a fixed graph cannot give us, which is a way to ask whether one measurable property of the structure we believe we see differs from chance. If we can generate purely random graphs with the same size and the same expected edge density as our market graph, we can compare them. When our market network looks no different from a coin-flip network on that measure, the structure offers no support for the forecast, and a cautious response is to stay flat.
In this article we build an Expert Advisor around this idea. We discretize the market into a small set of states, let bar-to-bar movement generate edges, and run a random walk on the resulting network to forecast direction. We then subject that network to an Erdos–Renyi null model and can optionally allow trades only when the structure passes the test. Finally, we treat each open position as its own small random walk over R-multiple milestones, and we let the learned survival probabilities decide when to take money off the table. Everything is estimated from the instrument in front of us, and the features are normalized so the same code runs on any symbol. The thresholds, periods, and exit levels are still fixed inputs, however, and they must be validated for each instrument.
Author: Hlomohang John Borotho