Skip to content
All library documents

Trend-Catching Expert Advisor with Moving Averages and Parabolic SAR

Article MQL5 code base

Summary

This MetaTrader Expert Advisor identifies trend direction using three moving averages, with example periods of 200, 50, and 25, and enters trades from Parabolic SAR signals. It can close positions on an opposite signal and includes options for choosing trading days, entering on a reverse signal, and preventing an opposite signal from closing an order. The description explains automatic or fixed stop-loss and take-profit settings: an automatic stop can be based on the distance to the SAR point, while take-profit can scale from the stop distance.

Position size is calculated from a risk percentage of account deposit and stop distance. An optional martingale feature increases the next trade’s risk after a losing trade by a configurable factor. The EA also supports moving a stop to breakeven after a profit threshold and trailing it after a second threshold. These are configurable mechanics, not evidence of profitability. The description gives no backtest results or market-specific validation, and the martingale setting can increase exposure after losses.

Key ideas

  • The EA uses three moving averages to identify trend and Parabolic SAR signals to initiate trades.
  • Stops and targets can be fixed or calculated from SAR distance and a configurable multiplier.
  • Position size is based on a risk percentage and stop distance.
  • An optional martingale setting increases risk after a losing trade, while breakeven and trailing rules manage open positions.

Tags

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