Skip to content
All library documents

Automating Trendline Bounce Signals with Least Squares Fit in MQL5

Article MQL5 articles

Summary

The document describes an MQL5 system for identifying support and resistance trendlines from price swing points using a least squares fit. It proposes treating lines with a minimum number of touches as candidates, checking their integrity and inclination, and generating buy signals near support or sell signals near resistance. Configurable parameters cover the swing lookback, touch and penetration tolerances, spacing between touches, line extension, trade size, stop distance, and risk-to-reward setting. The program also draws trendlines, touch markers, arrows, and labels for visual inspection.

The article says the system was backtested and includes references to a graph and report, but the supplied text provides no numerical results, market, timeframe, or test conditions. Thus, it explains an implementation concept rather than establishing that the bounce signals are profitable. Results may depend on swing detection, tolerances, parameter choices, and market conditions; the author recommends risk management and careful testing before deployment.

Key ideas

  • Least squares fitting is used to estimate support and resistance lines from detected swing points.
  • Candidate trendlines require multiple touches and are checked for integrity before signal generation.
  • The system buys near support and sells near resistance, with configurable tolerances and trade settings.
  • Chart drawings show detected lines and touches to make the automated logic easier to inspect.
  • The provided text mentions backtesting but gives no performance figures or test setup.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.