Skip to content
All library documents

Detecting Price Peaks and Troughs with a Minimum-Move Threshold

Article MQL5 code base

Summary

The document explains a MetaTrader function that identifies historical price peaks and troughs using a minimum price-change threshold. It describes the method as similar to the FastZZ indicator: the user supplies quote history and a required move size, and the function returns extrema in time order, with the most recent point first. Each result records whether it is a peak or trough, its timestamp, and its price.

The function can return all detected extrema or stop after a requested count. The example illustrates both modes using a threshold expressed in points and prints each returned turning point. This is a technical utility rather than a complete trading strategy: the document does not define how to trade the extrema, evaluate signals, or choose a suitable threshold. As with threshold-based turning-point methods generally, detected points depend on the chosen minimum move and historical price data; the document provides no performance tests or guidance on avoiding look-ahead when using the output in a strategy.

Key ideas

  • The function detects historical peaks and troughs using a user-specified minimum price change.
  • Each extremum contains its type, time, and price value.
  • Results are ordered with the most recent extremum first.
  • The caller can request a fixed number of extrema or retrieve all detected points.
  • The document explains the utility but provides no trading rules, threshold-selection method, or performance evidence.

Tags

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