Skip to content
All library documents

Moving Average Signals Filtered by Two-Bar Direction and Size

Article MQL5 code base

Summary

This signal module generates long and short trade votes from price position relative to a moving average. It adds protective filters based on the direction and minimum size of both the current and previous bars: long signals require bullish bars, while short signals require bearish bars. The moving average period, shift, smoothing method, applied price, trade direction, and signal reversal are configurable.

The article describes the required open and close price series and shows how the bar-size checks are applied before the moving-average condition. It says that enabling evaluation on every tick can detect when the current bar reaches the configured size threshold sooner. The accompanying expert advisor uses default parameters and was not optimized; the article supplies no performance results or evidence that the filters improve trading outcomes. The approach therefore describes signal construction rather than a validated strategy.

Key ideas

  • Long signals are filtered for bullish direction and minimum size in the current and previous bars.
  • Short signals apply corresponding bearish-bar checks.
  • The signal compares price with a configurable moving average and supports reversal and trade-direction settings.
  • Evaluating on each tick can recognize the current bar threshold as it is reached.
  • The example uses default settings without optimization or reported performance testing.

Tags

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