Discussing the article: "Integrating MQL5 with Data Processing Packages (Part 8): Using Graph Neural Networks for Liquidity Zone Recognition"

 

Check out the new article: Integrating MQL5 with Data Processing Packages (Part 8): Using Graph Neural Networks for Liquidity Zone Recognition.

This article shows how to represent market structure as a graph in MQL5, turning swing highs/lows into nodes with features and linking them by edges. It trains a Graph Neural Network to score potential liquidity zones, exports the model to ONNX, and runs real-time inference in an Expert Advisor. Readers learn how to build the data pipeline, integrate the model, visualize zones on the chart, and use the signals for rule-based execution.

The model and the Expert Advisor (EA) work together by dividing responsibilities between data preparation, machine learning inference, and trade execution. The EA operates as the real-time market interface inside MetaTrader 5, continuously collecting price data such as highs, lows, closes, and tick volumes. From this data, the EA constructs a structural representation of the market by detecting swing highs and swing lows, which are then organized into a graph where each swing point becomes a node and their structural relationships form edges. These nodes are enriched with features such as price level, swing type, and relative distance to neighboring swings. The prepared node features and edge connections are then passed to the trained Graph Neural Network (GNN) model, which processes the graph and returns predictions indicating the probability or strength of liquidity presence around each structural level.

Once the model completes its inference, the EA interprets the returned predictions to determine actionable trading signals. If the model identifies a high probability of liquidity resting above the current market structure, the system may anticipate a bullish move and prepare a buy position, whereas predicted liquidity below the structure may signal a potential sell opportunity. The EA then applies basic trade management rules—such as verifying spread conditions, confirming structural alignment, and calculating position parameters—before executing the order. Through this workflow, the machine learning model focuses on recognizing complex liquidity patterns, while the EA handles the operational aspects of trading, allowing the system to transform graph-based liquidity predictions into automated buy or sell executions within the trading platform.

Author: Hlomohang John Borotho

 
One picture is worth a thousand words. In the article about a graph why not to show a single scheme of the graph?