Skip to content
All library documents

Detecting Price Swings, Trends, and Double Tops or Bottoms in MQL5

Article MQL5 articles

Summary

This tutorial shows how to build MQL5 logic that identifies local highs and lows, then uses successive swing points to classify trend direction and detect possible double tops and double bottoms. It describes searching bar ranges for extrema, drawing lines between selected swing points, and comparing the relative heights of recent highs and lows against rules for upward, downward, or sideways movement. For double patterns, the examples use combinations of higher or lower highs and lows to label potential formations.

The article supplies coding steps and example chart signals, but the excerpt does not provide statistical tests of detection accuracy or evidence that the patterns predict profitable trades. The rules are based on selected lookback settings and chosen comparisons, so results depend on those definitions and may identify only candidate patterns. The author presents the logic as a starting point for extending detection to other chart formations and recommends further development and testing before real-account use.

Key ideas

  • Swing highs and lows can be found by searching a specified range of bars for local extrema.
  • Comparing successive highs and lows provides simple rules for labeling trend direction.
  • Double-top and double-bottom candidates are identified from relationships between recent swing points.
  • The method draws trend lines and reports pattern signals on the chart.
  • The examples illustrate detection logic but do not establish predictive or trading performance.

Tags

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