Skip links

A Profitable Gold Trading Strategy using Envelopes and DTI Indicator

  1. Trading Ranges: In a sideways or range-bound market, the Envelopes can act as dynamic support and resistance levels. Prices often oscillate between the upper and lower bands, offering potential buy opportunities near the lower band and sell opportunities near the upper band.

  2. Breakouts: A sustained move outside of the envelope, either above the upper band or below the lower band, can signify a breakout. This can be used to initiate trades in the direction of the breakout, but traders must be wary of false breakouts.

  3. Trend Identification: If prices consistently hug or remain close to the upper band, it’s indicative of a strong uptrend. Conversely, if prices stay near the lower band, it suggests a downtrend.

  4. Complementary Indicators: Envelopes can be paired with momentum indicators like the RSI or MACD. For instance, if the price is near the upper band and the RSI indicates overbought conditions, it can be a sell signal.

Dynamic Trend Indicator (DTI):
  1. Trend Confirmation: A DTI value above zero can confirm a bullish trend, while a value below zero can confirm a bearish trend. This can be particularly useful when initiating trades in the direction of the prevailing trend.

  2. Momentum Shifts: Sharp moves in the DTI value, either towards or away from the zero line, can indicate strengthening or weakening momentum, respectively. This can provide early signals for potential reversals or trend continuations.

  3. Divergence Strategies: As with many momentum indicators, divergence between the DTI and price can be a powerful signal. If the price makes a new high but the DTI fails to do so, it can indicate a bearish divergence, suggesting potential price reversals.

  4. Filtering Noise: By smoothing out price movements, DTI can help traders distinguish between genuine trend shifts and market noise, thus avoiding premature trade exits or entries based on minor price fluctuations.

In Trading Strategy Development:

When crafting a trading strategy, it’s essential to consider how these indicators can complement each other. For instance, a trader could use Envelopes to identify potential overbought or oversold conditions and then use the DTI to confirm the trend’s strength and direction. Additionally, setting proper risk management rules, including setting stop-losses and take-profit levels, is crucial when relying on technical indicators.

In summary, while both Envelopes and DTI offer valuable insights, their true strength is realized when integrated within a comprehensive trading strategy that considers market context and employs multiple analysis tools.

Lets get into the basics First:

The dataset contains the following columns:

  1. Date: The date of the data entry.
  2. Close: The closing price of XAU/USD.
  3. Envelope Upper: The upper envelope value.
  4. Envelope Basis: The basis of the envelope.
  5. Envelope Lower: The lower envelope value.
  6. DTI: The DTI value.

Here are the basic statistics for the numeric columns in the dataset:

  1. Close:

    • Mean: 1037.45
    • Median: 1185.18
    • Min: 252.10
    • Max: 2063.56
    • Standard Deviation: 550.83
  2. Envelope Upper:

    • Mean: 1086.89
    • Median: 1246.35
    • Min: 267.51
    • Max: 2109.00
    • Standard Deviation: 577.68
  3. Envelope Basis:

    • Mean: 1035.13
    • Median: 1186.99
    • Min: 254.77
    • Max: 2008.57
    • Standard Deviation: 550.17
  4. Envelope Lower:

    • Mean: 983.38
    • Median: 1127.65
    • Min: 242.03
    • Max: 1908.14
    • Standard Deviation: 522.66
  5. DTI:

    • Mean: 4.79
    • Median: 3.18
    • Min: -78.92
    • Max: 92.58
    • Standard Deviation: 32.10
Backtesting the Two Strategies:
Strategy 1:
  1. Buy: When the Close is touching the Lower Envelope.
  2. Sell: When the Close is touching the Upper Envelope.


  1. Long Strategy:

    • The strategy had 73 winning trades and 47 losing trades.
    • The average gain from a winning trade was $1,458.01, and the average loss from a losing trade was $1,730.57.
    • The strategy generated a total return of 25.10% over the backtest period.
    • The annualized return was 0.87%.
    • The Sharpe Ratio, which measures risk-adjusted performance, was 0.18.
    • The maximum drawdown, or the largest drop from peak to trough, was 10.27%.
    • The win rate, or the percentage of trades that were profitable, was 60.83%.
  2. Short Strategy:

    • The strategy had 111 winning trades and 106 losing trades.
    • The average gain from a winning trade was $1,288.16, and the average loss from a losing trade was $1,183.58.
    • The strategy generated a total return of 17.53% over the backtest period.
    • The annualized return was 0.63%.
    • The Sharpe Ratio was 0.11.
    • The maximum drawdown was 16.32%.
    • The win rate was 50.92%.

This detailed analysis provides a comprehensive overview of the performance of each strategy. It’s worth noting that higher Sharpe Ratios and win rates, combined with lower drawdowns, generally indicate better performance. However, it’s also essential to consider the absolute and annualized returns to understand the overall profitability of a strategy.

Strategy 2:

Strategy 2 (Long): Buy when the Close is touching or below the Lower Envelope and DTI > 0.

Strategy 2 (Short): Sell when the Close is touching or below the Lower Envelope and DTI < 0.

  • Final Capital: $220,702.20
  • Return on Investment (ROI): 120.70%
  • Mean Daily Return: 0.0139%
  • Volatility (Standard Deviation of Daily Returns): 0.6459%
Risk Management in Trading Strategy Enhancement:

In the realm of trading, a well-thought-out strategy can still be susceptible to significant drawdowns without robust risk management. The initial strategy we considered was based on a combination of price action (touching the lower envelope) and a technical indicator (DTI). While these are fundamental building blocks, the strategy’s performance can be significantly enhanced with risk management techniques.

  1. Position Sizing: Dynamic position sizing, as we implemented in the latter stages, is a cornerstone of risk management. By adjusting the size of a trade based on recent performance, a trader can capitalize on winning streaks while potentially limiting exposure during losing streaks. For instance, after a successful trade, increasing the lot size can amplify profits, but it’s crucial to ensure that the increased position doesn’t disproportionately increase the risk to the trading account. Conversely, after a losing trade, reducing the position size can help protect the capital from significant drawdowns. A more advanced approach could involve calculating position size based on the volatility of the asset, ensuring that during periods of heightened price fluctuations, exposure is reduced.

  2. Profit Targets and Stop Losses: Setting clear profit targets and stop losses is vital. In our modified strategy, we implemented fixed pip targets for both. While this is a good starting point, a more advanced approach could involve adapting these thresholds based on market conditions. For example, during periods of high volatility, wider stop losses and profit targets might be considered to account for the larger price swings. Conversely, in a low volatility environment, tighter stops and targets might be more appropriate.

  3. Max Drawdown Limit: Another advanced risk management technique involves setting a maximum drawdown limit for the trading account. If the account equity drops by a predefined percentage from its peak, all trading can be halted. This ‘circuit breaker’ can be crucial in preventing large losses during unforeseen market events or when the strategy is underperforming.


The exploration of gold trading strategies using the Envelopes and DTI indicators has shed light on the potential and pitfalls of technical trading approaches. While both indicators provide valuable insights individually, their combined use within a well-defined strategy offers a more robust trading framework. Strategy 1, based purely on the Envelopes, yielded decent results with the long strategy outperforming the short in terms of win rate. However, the integration of the DTI indicator in Strategy 2 enhanced the performance, as evidenced by the significant ROI. Yet, even a well-crafted technical strategy is not foolproof. Risk management, as highlighted, plays a pivotal role in safeguarding capital and optimizing returns. Techniques such as dynamic position sizing, setting clear profit targets, stop losses, and implementing a max drawdown limit can be game-changers in the turbulent world of trading. In essence, while technical indicators serve as invaluable tools for traders, a holistic approach that synergizes multiple indicators and prioritizes risk management is the key to sustainable and profitable trading.

Disclaimer: This is not an Investment Advice. Investing and trading in currencies involve inherent risks. It’s essential to conduct thorough research and consider your risk tolerance before engaging in any financial activities.