Skip to content
All library documents

Moving Average Direction Filter with Trend-State Signals

Article MQL5 code base

Summary

This indicator applies a direction filter to a moving average and marks changes among three states: rising, falling, and flat. Its configurable inputs include the moving-average period and method, the applied price, an anchor offset measured in bars, and a threshold for comparing the current average with its value at that anchor. The indicator changes the average’s displayed color and places a pointer when it registers a state transition.

The description gives qualitative transition rules based on the difference between the current and anchored moving-average values. However, the stated comparisons overlap at the threshold: the falling and flat conditions can both include values less than or equal to the anchor difference. This makes the precise classification rule unclear from the text alone. No chart examples, backtest, or evidence of trading performance is provided, so the tool should be treated as a visual trend-state aid whose parameters and boundary behavior require verification before use.

Key ideas

  • The indicator labels moving-average direction as rising, falling, or flat.
  • It compares the current moving-average value with its value at a configurable anchor offset.
  • The period, method, applied price, anchor offset, and threshold are configurable inputs.
  • Color changes and pointers mark detected state transitions.
  • The stated falling and flat threshold rules overlap, leaving boundary classification unclear.

Tags

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