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: Traversal Breadth-First Search (BFS) Applied in Trading.
Breadth First Search (BFS) uses level-order traversal to model market structure as a directed graph of price swings evolving through time. By analyzing historical bars or sessions layer by layer, BFS prioritizes recent price behavior while still respecting deeper market memory.
The BFS Market Structure EA will transform traditional technical analysis by applying graph theory concepts to market price action. The system begins by detecting significant swing points (highs and lows) from historical price data, treating each swing as a node in a directed graph where edges represent chronological progression. Using Breadth-First Search (BFS) traversal starting from a configurable historical anchor point, the algorithm processes market structure in level-order—analyzing nearest swings first before moving to older formations. Each swing node is classified as bullish or bearish based on comparative price relationships, with more recent structures weighted more heavily in the final bias calculation. This produces a continuous bias score ranging from -1 (bearish) to +1 (bullish), representing the structural evolution of the market rather than traditional indicator-based signals.
The trading decision layer filters potential trades through this structural bias, requiring the score to exceed configurable thresholds before allowing buy or sell positions. When enabled, the EA executes trades using professional order management via the CTrade class, with optional confirmation through recent swing breakouts. The system includes three distinct context modes—previous bars for scalping, previous days for swing trading, and yesterday-only for intraday bias—allowing adaptation to different trading styles. Real-time visualization displays the swing graph with color-coded nodes and edge connections, making the structural analysis transparent and providing immediate feedback on market conditions. This approach creates a systematic, rules-based methodology that focuses on understanding market structure evolution rather than predicting future price movements.
Author: Hlomohang John Borotho