Skip to content
All library documents

Trend Envelopes: A High-Low Moving Average Filter with Ratcheting Stops

Article ProRealCode

Summary

Trend Envelopes is a trend-following overlay built from moving averages of highs and lows. The upper and lower bands form a range that responds to recent price extremes. A close beyond the prior band changes the regime; closes between the bands leave the existing state intact. This latching rule is intended to reduce flips during ordinary pullbacks without using ATR as a separate volatility input.

In an uptrend, the lower band is prevented from declining; in a downtrend, the upper band is prevented from rising. The active band therefore acts as both a displayed trail and the level whose breach reverses the regime. A marker identifies flips, and candle coloring is optional. The author suggests using the indicator for exits, regime filtering, reversal entries, or multi-timeframe confirmation. The document explains the construction and provides ProBuilder code, but no performance tests or market-specific evidence; parameter choices also affect lag and whipsaw frequency.

Key ideas

  • The indicator forms an envelope from separate moving averages of highs and lows.
  • Trend state changes only when the close breaches the previous opposite band.
  • The active band ratchets in the favorable direction and serves as a trailing stop.
  • A trend-flip marker can guide entries, while the trail can manage exits or filter trades.
  • Shorter lookbacks react faster but may produce more whipsaws, while longer lookbacks react more slowly.

Tags

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