Login / Register
Add a review
Log in
Sign UP
Moving Average Envelope tfmt5


In the Moving Average Envelope system, the entry is based on the price breakdown of the upper or lower envelope, based on a percentage of the simple moving average. As soon as the price breaks through the envelope, the Expert Advisor opens a new position on the trend if the price continues to move. The SMA in the middle of the envelopes is used as a trailing exit when the price reaches this level. Note that the envelopes must be configured for each timeframe and symbol, as they are not dynamic, in order for the envelope range around the price to be set correctly. Use our free Moving Average Envelope indicator to find the right percentage for your chart.

Note: the default input values are not optimized. Test the Expert Advisor on a demo and adjust the input parameters according to the acceptable risk and goals. Trend-tracking systems are based on long-term probabilities. Although such systems have lower win rates, profitability comes from large trends, in such systems losses are limited, and profitability is increased. Testing on a portfolio of symbols has shown that gains on trend symbols compensate for small losses and can provide profits when there is no trend for other symbols.

Enters the market when the price moves above or below the envelopes. The EA adds a position as soon as the price rises above the upper envelope or falls below the lower one, it does not wait for the next bar to appear. If the value of the Max_Units parameter is greater than 1, additional pyramid inputs will be used with the ATR step specified in the ATR_between_Pyramids parameter.

[spoiler title=”

Outputs with trailing moving average in the middle of the Moving Average Envelopes. The EA exits long positions when the price reaches or falls below the moving average. The EA exits short positions when the price reaches or rises above the moving average.

Position and stop size:

The Expert Advisor calculates the position size based on the volatility value, this is directly related to the stops. For stops, the ATR_Periods and Stop_Range_ATR parameters are used to calculate the ATR, which are then multiplied by a certain coefficient to set the size to the stop level from the opening price. Stops are not encoded in the position, but the EA closes the position when the price reaches the stop value. Since the position volume can increase with the pyramid system, the stops move in accordance with the last entry price. Based on the stop values, the Risk_Percent parameter, and the account information (tick size, lot size, number of decimal places, etc.), the position size selection uses the distance from the entry price to the stop level in monetary terms, and also takes into account the number of lots within the percentage you specified.

  • MA_Periods: The number of bars to build a simple moving average in the middle of the envelopes.
  • Envelope_Percent: The percentage of the moving average added to the moving average to build the upper and lower envelope of the moving averages.
  • Risk_Percent: the percentage of risk for each position at the close of the stop. For example: if the risk percentage should be equal to 2% of the equity, specify 2 in this parameter.
  • ATR_Periods: The number of bars to calculate the ATR.
  • Stop_Range_ATR: This value will be multiplied by ATR to determine the distance of the stop from the entry price. For example: if the stop should be at a distance of 2*ATR from the price, specify 2 in this parameter.
  • Max_Units: the maximum number of position entries (including the very first initial entry) in the pyramid system when the profit on the position increases.
  • ATR_between_Pyramids: this value will be multiplied by the ATR and used to calculate when the next position in the pyramid should be added. For example: specify at a value of 1.5 the next entry in the pyramid system will occur when the price reaches the value of input price plus (1.5 * ATR) for long positions and input price minus (1.5 * ATR) for short positions.
  • Slippage: Allowed slippage when entering a position.
  • Reduction_Percent: The value by which the equity should be reduced to calculate the position size. For example: during the drawdown period, you can specify 20 in this parameter and the position size will be 20% smaller. The position size calculation function will determine the equity size as 80% of the real value to reduce risks until the drawdown ends.


Add review
Reviews ( 0 ):