i took my time reading this,all i can say is thanks for this masterpiece
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: Feature Engineering for ML (Part 12): Fractal Features in MQL5.
A direct MQL5 port of the fractal detector writes each pattern at its center bar, so a buffer read by an expert advisor holds a value that only existed n bars later. We implement CFractalFeatures.mqh with ProcessBar for bar-by-bar use and Compute for full-series recalculation, covering detection, strength scored against a fixed or volatility-scaled floor, an event-based support/resistance ring, and trend-filtered breakout signals. Output is eighteen buffers published at the confirmation bar, verified against the Python reference to within 1e-13.
A Williams fractal is a local extremum of a window of 2n+1 bars, with the candidate at the center (Williams, 1998). The pattern is symmetric: it needs n bars before the candidate and n bars after it. The bars after the candidate are the problem. At the moment bar c closes, the window [c-n, c+n] is still open, and the earliest moment the pattern can be evaluated is the close of bar c+n.
This produces two defensible conventions and one indefensible one. A chart annotation may be drawn on bar c, because a marker is a statement about where the extremum occurred, and every trader reading the chart in real time knows the marker appeared n bars later. A feature buffer may not be written at bar c, because a consumer that reads buffer[c] has no way to know that the value arrived late. The indefensible convention is the one that makes both writes to the same buffer.
Author: Patrick Murimi Njoroge