Skip to content
All library documents

Stop-Loss and Take-Profit Direction Switching with SAR and ADX Filters

Article MQL5 code base

Summary

This expert advisor uses the outcome of its last closed position to determine the next trade direction. After a take-profit exit, it seeks another trade in the same direction; after a stop-loss exit, it switches direction. It permits one open position and can move a position to breakeven when that option is enabled.

Entries also require a Parabolic SAR and closing-price relationship that matches the intended direction, while ADX must be below 20. The document lists stop-loss, take-profit, per-trade risk, and breakeven settings, and gives a EURUSD, 30-minute example period. It does not report performance results, explain how signals were validated, or provide enough detail to assess robustness. The SAR and ADX checks are described on the current bar, so the note alone does not establish how intrabar signal changes or execution costs affect outcomes.

Key ideas

  • A take-profit exit leads to a proposed next trade in the same direction, while a stop-loss exit leads to the opposite direction.
  • BUY and SELL entries use opposite Parabolic SAR and closing-price conditions.
  • ADX must be below 20 for either entry direction.
  • The system allows one position and includes configurable stop-loss, take-profit, risk, and breakeven settings.
  • The document provides no reported backtest results or robustness analysis.

Tags

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