Skip to content
All library documents

Building an Adaptive SuperTrend Expert Advisor with Risk Controls

Article MQL5 articles

Summary

This article turns an Adaptive SuperTrend indicator into a self-contained MQL5 expert advisor. The indicator combines SuperTrend with divergence from either MPO4 or RSI; when opposing divergence appears, an optional adjustment shrinks the ATR multiplier to try to flag weakening trends earlier. The EA calculates this logic internally rather than reading an external indicator, then detects signals and manages orders and positions.

The design adds optional confirmation bars to reduce sensitivity to repainting, dynamic position sizing, ATR-based stop placement, risk-reward-based trailing stops, and session filters. The article describes these as configurable components and includes a strategy-tester comparison that attributes changes in performance and equity stability to individual additions. However, the provided text does not include the underlying figures, test setup, or enough detail to assess robustness. It recommends further evaluation across instruments, timeframes, and market conditions; its reported comparisons should therefore be treated as limited evidence rather than proof of general effectiveness.

Key ideas

  • The EA embeds the Adaptive SuperTrend calculation, combining trend structure with divergence from MPO4 or RSI.
  • An optional adaptive adjustment reduces the ATR multiplier when opposing divergence appears.
  • Position sizing, ATR-based stops, trailing stops, confirmation bars, and session filters provide configurable risk and trade controls.
  • Internal calculations remove the EA's dependency on an external indicator file but duplicate logic that may need synchronization.
  • The reported tester comparisons lack sufficient figures and setup details in the provided text to establish broad robustness.

Tags

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