Trading Indicator

Using Envelopes in Automated Trading

Learn how Envelopes indicator rules can be translated into no-code automated trading strategies with Tradeworks.

Envelopes indicator using moving average bands for mean-reversion trading

Fundamentals

Understanding Envelopes

Envelopes technical indicator is formed with two Moving Averages, one of which is shifted upward and another one is shifted downward. The selection of optimum relative number of band margins shifting is determined by the market volatility: the higher the latter is, the stronger the shift is. Envelopes define the upper and the lower margins of the price range.

How Envelopes Work

  • Upper Envelope: Moving Average + (MA × percentage)
  • Middle Band: Base Moving Average (typically EMA 20)
  • Lower Envelope: Moving Average - (MA × percentage)
  • Mean-Reversion: Price tends to return to the middle band after reaching envelopes
  • Breakout: Price closing beyond envelope signals strong momentum

The Envelopes indicator uses percentage-based bands around a moving average to identify overbought and oversold conditions. When price reaches the upper envelope, it may indicate selling pressure. When price reaches the lower envelope, it may indicate buying pressure. This makes it suitable for mean-reversion and breakout automated trading strategies.

Strategy 1: Envelopes Mean-Reversion

Trading Price Deviations

Envelopes Mean-Reversion Strategy for automated trading

The Mean-Reversion strategy uses Envelopes to test when price has moved away from the moving average and may return toward the middle band. When price touches the lower envelope, the setup can test long-entry rules. When price touches the upper envelope, it can test short-entry rules.

Setup in Tradeworks:

  1. Add Envelopes indicator to your strategy
  2. Set parameters: MA Period = 20, Deviation = 2.5%
  3. Configure mean-reversion entry conditions:
    • Open Position Buy Signal: Strategy symbol ASK price crosses from above to below lower envelope
    • Open Position Sell Signal: Strategy symbol BID price crosses from below to above upper envelope

Trade Management

  • Stop Loss Exit Signal:
    • For longs: 'Strategy symbol BID price is less than (Previous bar close minus (ATR × 2.0))'
    • For shorts: 'Strategy symbol ASK price is greater than (Previous bar close plus (ATR × 2.0))'
  • Take Profit Exit Signal:
    • For longs: 'Strategy symbol BID price crosses from below to above middle band (EMA 20)'
    • For shorts: 'Strategy symbol ASK price crosses from above to below middle band (EMA 20)'
  • Testing note: Compare chart intervals and instruments in backtesting before deciding where this setup fits your approach.
  • Filter: Combine with RSI for overbought/oversold confirmation (RSI below 30 for buys, RSI above 70 for sells)

Strategy 2: Envelopes Breakout

Momentum Trading

Envelopes Breakout Strategy for momentum trading

The Breakout strategy uses tighter Envelopes to test when price moves beyond a consolidation range. When price closes beyond the upper envelope, the setup can test bullish continuation rules. When price closes below the lower envelope, it can test bearish continuation rules.

Setup in Tradeworks:

  1. Add Envelopes indicator to your strategy
  2. Set parameters: MA Period = 20, Deviation = 1.5% (tighter bands)
  3. Configure breakout entry conditions:
    • Open Position Buy Signal: Strategy symbol ASK price closes above upper envelope
    • Open Position Sell Signal: Strategy symbol BID price closes below lower envelope

Trade Management

  • Stop Loss Exit Signal:
    • For longs: 'Strategy symbol BID price is less than (Previous bar close minus (ATR × 1.5))'
    • For shorts: 'Strategy symbol ASK price is greater than (Previous bar close plus (ATR × 1.5))'
  • Take Profit Exit Signal:
    • For longs: 'Strategy symbol BID price crosses from below to above (upper envelope + 1.5 × envelope width)'
    • For shorts: 'Strategy symbol ASK price crosses from above to below (lower envelope - 1.5 × envelope width)'
  • Testing note: Compare chart intervals and instruments in backtesting before deciding where this setup fits your approach.
  • Filter: Add MACD for trend confirmation

For Bot Developers: Implementation Tips

Parameter Tuning for Envelopes

  • MA Period: 20 is standard, but 10 works for faster signals, 50 for smoother
  • Deviation Percentage: 2.0-2.5% for most pairs. Increase for volatile pairs, decrease for stable pairs
  • Dynamic Adjustment: Use ATR to dynamically adjust deviation based on current volatility
  • EMA vs SMA: EMA responds faster to price changes, SMA provides smoother signals

Combining with Other Indicators

  • RSI Filter: Only take buy signals when RSI is below 30 (oversold), sell signals when RSI is above 70 (overbought)
  • MACD Confirmation: Use MACD histogram for trend direction confirmation
  • Bollinger Bands: Compare envelope signals with Bollinger Bands for double-confirmation
  • ATR for Position Sizing: Use ATR to adjust stop loss based on current volatility

Multi-Timeframe Envelope Analysis

  • Higher Timeframe Trend: Use daily envelopes to identify overall trend direction
  • Lower Timeframe Entries: Enter on 1-hour or 15-minute charts with envelope signals
  • Alignment: Only take trades in the direction of the higher timeframe envelope trend

Avoiding False Signals

  • Wait for Close: Require price to close beyond envelope before entering
  • Confirmation Candle: Wait for a confirmation candle before entry
  • Volatility Filter: Increase envelope deviation during high volatility periods
  • Trend Filter: Use a 200-period MA to filter trades against the prevailing trend

Manageable Beginner Setup

  1. Start with Standard Settings: EMA 20 with 2.0% deviation
  2. Add RSI Filter: Only take buys when RSI is below 40, sells when RSI is above 60
  3. Use Wider Stops: Start with 2× ATR stop loss to accommodate volatility
  4. Focus on Major Pairs: EUR/USD, GBP/USD for backtesting practice
  5. Paper Trade First: Test your envelope strategy before going live
?

Questions

Frequently Asked Questions

What's the difference between Envelopes and Bollinger Bands? +

While both are trading bands, Envelopes use a fixed percentage deviation from a moving average, while Bollinger Bands use standard deviation which adapts to market volatility. Envelopes are simpler to configure, while Bollinger Bands automatically adjust to volatility changes.

How do I adjust envelope percentage for different volatility? +

For volatile conditions, consider higher deviation (2.5-3.0%). For more stable periods, lower deviation (1.5-2.0%) may be appropriate. Adjust based on current market conditions rather than specific pairs. You can also use ATR to dynamically calculate deviation: envelope deviation = (ATR / MA) × multiplier. A common starting point is ATR(20) / MA × 2.

Can Envelopes work in trending markets? +

Envelopes work differently in trending vs. ranging markets. In ranging markets, price tends to bounce between envelopes (mean-reversion). In trending markets, price can ride along the outer envelope for extended periods. Use the Breakout strategy for trending markets and Mean-Reversion for ranging markets.

What timeframes work commonly with Envelopes? +

A standard 20-period EMA with 2% deviation is a common starting point for 1-hour to daily charts. For intraday examples, test faster settings like EMA 10 with 1.5% deviation. For swing-trading examples, test EMA 50 with 2.5% deviation on 4-hour to daily charts.

How do I avoid false signals with Envelopes? +

Avoid false signals by: 1) Waiting for price to close beyond the envelope before entering, 2) Adding confirmation with RSI or MACD, 3) Using wider envelopes during high volatility, 4) Filtering trades with a higher timeframe trend indicator, 5) Avoiding choppy markets where price constantly penetrates envelopes.

Try it in Tradeworks

Want to try Envelopes in Tradeworks?

Build and test Envelopes rules in a no-code strategy builder before deciding whether they fit your trading approach.

Volume Indicators

Volume indicators measure the strength of price movements by analyzing trading volume. They help confirm trends and identify potential reversals.

Volatility Indicators

Volatility indicators measure the rate of price change. They help traders set stop losses, determine risk levels, and identify potential breakouts.

Bill Williams Indicators

A collection of indicators developed by Bill Williams for trend identification, momentum analysis, and fractal pattern recognition.