Skip to content
All library documents

Building a Non-Repainting Supertrend Indicator in MQL5

Article MQL5 articles

Summary

The article explains Supertrend as a volatility-based trend indicator that combines Average True Range with a price midpoint and a trailing band. The band sits below price in a bullish state and above price in a bearish state; a close through it changes the indicated trend. The tutorial builds a custom MQL5 indicator that uses the platform’s ATR calculation and discusses chart rendering, buffer management, and live-bar calculation.

The stated design goal is to keep closed-bar trend decisions from changing retroactively, making the indicator usable as an input to expert advisors or signal tools. The article describes user controls for the ATR lookback and multiplier and presents a chart example as confirmation that its calculations and display work. This is an implementation tutorial, not evidence that Supertrend predicts reversals or produces profitable trades. The introduction’s dramatic market example and performance claims are not substantiated by a systematic test in the supplied text, and the indicator’s results will depend on chosen parameters and market conditions.

Key ideas

  • Supertrend uses ATR-based volatility bands to represent a bullish or bearish trend state.
  • A close through the trailing band flips the indicator’s trend state.
  • The MQL5 example consumes ATR values from the platform and exposes period and multiplier inputs.
  • The implementation aims to preserve closed-bar decisions without repainting them later.
  • The tutorial demonstrates indicator construction, not the profitability or predictive power of a trading strategy.

Tags

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