Skip to content
All library documents

Color-Changing Moving-Average Signals with Loss-Based Position Sizing

Article MQL5 code base

Summary

This Expert Advisor combines three independent systems that use ColorXPWMA_Digit indicators. Each system signals a potential trend change when a bar closes and its indicator changes color. The systems can be enabled or disabled separately, allowing their results to be assessed individually. The compiled indicator is required for operation.

Each system has separate long and short trade histories and position-size settings. The example reduces the next trade’s size in a direction when enough of the most recent trades in that direction are losses: three losses among the last five trigger a smaller size, while fewer losses retain the normal size. The document reports tests on USDJPY at two-, four-, and eight-hour intervals over 2017, using default settings with stops, but supplies no numerical performance results. This loss-based sizing rule is a configurable response to recent losses, not evidence that risk or drawdowns are reduced; the brief test description does not establish robustness or live-trading suitability.

Key ideas

  • The EA contains three separately configurable systems based on color changes in moving-average indicators.
  • Signals are generated at bar close when an indicator changes color to show a trend change.
  • Each system can reduce trade size after a configured number of recent losses in the same direction.
  • The example uses a smaller size after three losses among the latest five directional trades.
  • The document cites USDJPY tests at three bar intervals for 2017 but gives no numerical performance results.

Tags

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