In the Average True Range Envelope system, the entry is based on the breakdown of the upper or lower envelope price, built by the ATR multiplier around a 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. Use our free ATR Envelope indicator to find the appropriate ATR values when building ATR Envelopes.
Note: the default input values are not optimized. Test the expert on a demo and configure the input parameters in accordance with 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, losses are limited in such systems, and profitability increases. Testing on a portfolio of symbols showed that profits on trend symbols compensate for small losses and can provide profit when there is no trend for other symbols.
It enters the market when the price moves above or below the envelopes. The Expert Advisor 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=”Read More…”]
Outputs with a trailing moving average in the middle of the ATR Envelopes envelopes. The Expert Advisor exits long positions when the price reaches or falls below the moving average. The Expert Advisor exits short positions when the price reaches or rises above the moving average.
The Expert 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. The stops are not encoded in the position, but the Expert Advisor 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 account information (tick size, lot size, number of decimal places, etc.), when choosing the position size, the distance from the entry price to the stop level in monetary terms is used, and the number of lots within the percentage specified by you is also taken into account. This allows you to work with any symbols, price and volatility. Since the amount of funds on the account changes, the position size will also be set in accordance with the changes.
- MA_Periods — the number of bars to build a simple moving average in the middle of the ATR envelopes.
- ATR_Env_Periods — the number of bars used to build the Average True Range for ATR envelopes coverts.
- ATR_Multiples_Env-ATR multiplier for constructing the upper and lower ATR envelopes.
- Risk_Percent — the percentage of risk for each position when closing a 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) according to the pyramid system when the profit for the position increases.
- ATR_between_Pyramids — This value will be multiplied by ATR and used to calculate when the next position should be added to the pyramid. 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 the input price plus (1.5 * ATR) for long positions and the input price minus (1.5 * ATR) for short positions.
- Slippage — permissible 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 before the drawdown ends.