Self Tuning Envelopes
- Indicateurs
- Anthony Garot
- Version: 1.1
Introduction
MT5 ships with the Envelopes indicator. This indicator allows you to create equidistant bands from a moving average by specifying a “deviation.” Unfortunately, the deviation is an arbitrary number. You might determine that 0.220 works well to contain 95% of close prices for USDCHF,H1, but when you change the period to H4, most of the bars are now outside the bands.
So, I created this self-tuning indicator. Instead of specifying a percent “deviation,” you specify the percent of bars you wish to “poke through” the bands. Using the above example, you could specify that you want 5% of bar closes within 200 bars to poke through the bands. That is:
-
Percent Bars Outside = 5
-
Tuning Method = Close
-
Tuning Period = 200
When you switch from H1 to H4, or even to M30, the bands will always contain 95% of closes. You can also switch from EURUSD to GBPJPY without a hitch.
Notes
-
Bands are always equidistant from the center moving average, but bands are not a fixed distance for all bars (as they are with the MT5 Envelopes indicator).
-
The upper and lower band values are calculated from the last “full” bar. That is, bands are not calculated each tick.
-
Upper and Lower band values are not re-painted on the display for new calculations. Once calculated, band values are displayed and not changed. Internal calculations do re-calculate band values when fitting the 5% (example) criterion; however, these internal calculations are not displayed. Just remember: the displayed upper and lower band values are correct only looking into the past, i.e. to the left of the bar in question.
Disclaimers
Mac & Linux
Do not download this product if you have a Mac.
Wine doesn’t support the Market tab. Do not download this product if you do not have a Markets tab in MT5.
Features
-
Auto-tuning on any period or symbol
Indicator’s Parameters
Center MA period – This specifies the period of the center moving average, e.g. 10, 12, 14.
MA Method – This specifies the method of the center moving average, e.g. EMA, SMA, etc.
Applied Price – This specifies the Applied Price of the center moving average, e.g. PRICE_CLOSE.
Tuning Period – This specifies the lookback period for tuning. It should be considerably longer than the MA period. I typically use 200; but you could make this value something like 252 (# of trading days in a year) or 120 (# of trading hours within a week). Add multiple versions of this indicator to the same chart, varying this number, to get a sense of what it does. The larger the number, the more calculations are necessary. If speed is a concern, like on an M5 chart, try changing this to 100. Lesser values, like 50, work—but the resulting bands are very different from the MT5 Envelopes indicator.
Tuning Method – This specifies if close or high/low prices are used to determine the percent of bars that poke through the bands.
Percent Bars Outside – Specifies was percent of bars poke through the upper and lower bands based upon the Tuning Method. Obviously, High/Low will have slightly wider bands than Close. I typically use 5% for this.
Very good idea thanks