Category Volatility  Published on 12/10/2020

Bollinger Band Cloud

Description

 

Responding to a forum requst on adding clouds to Bollinger Bands: https://ctrader.com/forum/suggestions/20979

If people want any development work done, you can get in contact with us at: development@fxtradersystems.com

Or via the website at: fxtradersystems.com/support/


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Cloud("Top", "Bottom")]
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class BollingerBandCloud : Indicator
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter("Periods", DefaultValue = 20, MinValue = 1)]
        public int Periods { get; set; }

        [Parameter("Standard Deviations", DefaultValue = 2, MinValue = 0)]
        public double SDs { get; set; }

        [Parameter("Moving Average Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType MAType { get; set; }

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

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

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

        private BollingerBands bollingerBands;
        protected override void Initialize()
        {
            bollingerBands = Indicators.BollingerBands(Source, Periods, SDs, MAType);
        }

        public override void Calculate(int index)
        {
            Main[index] = bollingerBands.Main[index];
            Top[index] = bollingerBands.Top[index];
            Bottom[index] = bollingerBands.Bottom[index];

        }
    }
}


fxtradersystems's avatar
fxtradersystems

Joined on 10.09.2020

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: BollingerBandCloud.algo
  • Rating: 5
  • Installs: 2030
Comments
Log in to add a comment.
CO
codey · 3 years ago

Thanks a lot.  How can I change the colour of cloud?