Envelopes

by longshot in category Trend at 31/05/2013
Description

Moving Average Envelopes are percentage-based envelopes set above and below a moving average. The moving average, which forms the base for this indicator, can be a simple or exponential moving average. Each envelope is then set the same percentage above or below the moving average. This creates parallel bands that follow price action. With a moving average as the base, Moving Average Envelopes can be used as a trend following indicator. However, this indicator is not limited to just trend following. The envelopes can also be used to identify overbought and oversold levels when the trend is relatively flat.

Download
3777 downloads
How to install
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class EnvelopeChannels : Indicator
    {
        private int Period = 10;
        private MovingAverage expo;


        [Parameter(DefaultValue = 20)]
        public int EnvelopePeriod { get; set; }

        [Parameter(DefaultValue = 0.5)]
        public double BandDistance { get; set; }

        [Output("Main")]
        public IndicatorDataSeries EnvelopeMain { get; set; }

        [Output("ChannelUp", Color = Colors.Red)]
        public IndicatorDataSeries ChannelUp { get; set; }

        [Output("ChannelLow", Color = Colors.Blue)]
        public IndicatorDataSeries ChannelLow { get; set; }

        [Parameter("MAType")]
        public MovingAverageType matype { get; set; }

        protected override void Initialize()
        {
            expo = Indicators.MovingAverage(MarketSeries.Close, EnvelopePeriod, matype);
        }

        public override void Calculate(int index)
        {
            EnvelopeMain[index] = expo.Result[index];
            ChannelUp[index] = expo.Result[index] + (expo.Result[index] * BandDistance) / 100;
            ChannelLow[index] = expo.Result[index] - (expo.Result[index] * BandDistance) / 100;
        }
    }
}
Comments

Hugo - May 16, 2014 @ 04:04

Is there a way to prevent the envelope indicator auto-scaling the chart? 

cTrader Team - May 16, 2014 @ 09:28

Yes, you can specify AutoRescale = false for Indicator attribute

usynn - June 19, 2015 @ 06:43

can you put in a standard deviation like in MT4?

ironmine - June 17, 2016 @ 13:59

Is it possible to make an auto envelope out of this indicator? Automatically narrowing or widening, so that the width of the channel would always contain inside 95% of the prices? Thanks.

berdyev98 - December 11, 2016 @ 20:48

What about autosizing, when I change the time frame from D1 to h1 or less, diagrams are very thin. How to fix it?

getting - January 17, 2017 @ 16:51

Someone please make an Envelopes EA please......

getting - January 17, 2017 @ 17:19

with trailing SL

5