Skip to content
All library documents

Drawing Recent Trend Lines with DeMark-Style Pivot Rules

Article MQL5 articles

Summary

The article presents an indicator that selects two swing points using DeMark-inspired rules, then draws rising or falling trend lines. Candidate peaks and troughs are identified by comparing each bar with its neighbors and applying additional close-price conditions. After two points are found, the method checks their ordering and tests whether the close after the first point agrees with the projected line. A failed check restarts the search; a validated line is extended across nearby bars and drawn on the chart.

The indicator emphasizes the latest market direction with a thicker solid line and shows the preceding direction with a thinner dotted line. The article walks through MQL4 buffers, pivot searches, line calculations, and chart-object drawing. It provides no statistical tests or trading results, so the plotted lines should be treated as a visual analysis aid rather than demonstrated predictive signals. Its fixed search ranges and rule thresholds also constrain how the approach applies across instruments and timeframes.

Key ideas

  • The indicator identifies candidate pivots by comparing highs or lows with neighboring bars.
  • Additional close-price tests validate the two points before a trend line is drawn.
  • A failed validation resets the search so another second pivot can be considered.
  • The most recent trend direction is emphasized, while the preceding direction remains visible for context.
  • The article provides implementation mechanics but no evidence that the lines predict profitable trades.

Tags

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