Skip to content
All library documents

Moving Average Bias With Scaling and Equity Controls

Article MQL5 code base

Summary

This Expert Advisor is a configurable framework for studying trade management around a moving-average bias. It can switch between long and short positions, restrict trading to one direction, or add positions as price moves either with or against the existing exposure. Stop loss, take profit, trailing protection, and equity-based limits are optional controls. Position size adjusts with account balance, and the bot can stop adding positions or close them all when free equity falls below a chosen threshold.

The document explains settings for spacing added positions, changing the spacing when averaging down, and closing trades when the moving-average bias crosses. It also specifies that decisions are made only at the start of each chart bar, so the chart timeframe sets the evaluation frequency and testing on open bars is more suitable than every-tick testing. No performance evidence is supplied; the author warns that configurations can lose the account, expects manual oversight, and recommends demo forward testing. Trades on the symbol are managed without a magic-number filter, and outside trades in the opposite direction can interfere with the system.

Key ideas

  • A moving average supplies directional bias while trade management settings determine entries, exits, and added positions.
  • The system can average up, average down, or both, with configurable spacing between additions.
  • Free-equity thresholds can halt new positions or trigger closure of all open positions.
  • The EA evaluates conditions only when a new chart bar begins, making timeframe choice part of its operating frequency.
  • Backtesting and live use require caution because the document provides no evidence of profitability.

Tags

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