Skip to content
All library documents

A Two Moving Average Expert Advisor with Risk-Based Sizing and Trade Controls

Article MQL5 code base

Summary

This MetaTrader expert advisor trades using two moving averages and lets the user choose between fixed-lot sizing and sizing based on a percentage of free margin. Stop loss, take profit, and trailing stop features can each be enabled or disabled. A configurable start and end hour can restrict when the advisor is allowed to trade.

The page mentions a historical test on hourly data using every-tick modeling over a four-month period, but it provides no performance figures or details about the traded instrument, costs, or robustness checks. The description therefore explains configurable mechanics rather than demonstrating that the moving-average signal is profitable. Risk-percentage sizing is tied to free margin, and the source gives no further rules for position sizing or risk limits.

Key ideas

  • The advisor generates trades from two moving averages.
  • Position size can be set manually or linked to a percentage of free margin.
  • Stop loss, take profit, and trailing stop controls are optional.
  • Trading can be restricted to a configured time window.
  • A short hourly historical test is mentioned without results or robustness details.

Tags

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