Category Trend  Published on 02/02/2023

BollingerBand Over Stretch indicator

Description

BollingerBand Over Stretch indicator (idea from mariocontaforex)

this indicator try to identify reverse signals based on standard deviation of mean. for more filter signals use SMA with periods 200


//idea: mariom
using System;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, AutoRescale = false, AccessRights = AccessRights.None)]
    public class mBBos : Indicator
    {
        [Parameter("BB Period", DefaultValue = 20)]
        public int inpPeriodBB { get; set; }
        [Parameter("BB StdDev", DefaultValue = 1.618)]
        public double inpStdDevBB { get; set; }
        [Parameter("BB Smooth Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType inpSmoothTypeBB { get; set; }
        [Parameter("Bar Color", DefaultValue = "Black")]
        public Color inpColor { get; set; }
        [Parameter("Show Bollinger Components (true)", DefaultValue = true)]
        public bool inpShowBollinger { get; set; }

        [Output("BB Top", LineColor = "Silver", PlotType = PlotType.DiscontinuousLine, Thickness = 1)]
        public IndicatorDataSeries outQMASMABBup { get; set; }
        [Output("BB Mid", LineColor = "Silver", PlotType = PlotType.DiscontinuousLine, Thickness = 1)]
        public IndicatorDataSeries outQMASMABBmid { get; set; }
        [Output("BB Bottom", LineColor = "Silver", PlotType = PlotType.DiscontinuousLine, Thickness = 1)]
        public IndicatorDataSeries outQMASMABBdn { get; set; }
        
        private BollingerBands _bbands;
                

        protected override void Initialize()
        {
            _bbands = Indicators.BollingerBands(Bars.ClosePrices, inpPeriodBB, inpStdDevBB, inpSmoothTypeBB);
        }

        public override void Calculate(int i)
        {
            if(Bars.LowPrices[i] < _bbands.Bottom[i] && Bars.ClosePrices[i] > Bars.OpenPrices[i])
                Chart.SetBarColor(i, inpColor);
            if(Bars.HighPrices[i] > _bbands.Top[i] && Bars.ClosePrices[i] < Bars.OpenPrices[i])
                Chart.SetBarColor(i, inpColor);
            
            if(inpShowBollinger)
            {
                outQMASMABBup[i] = _bbands.Top[i];
                outQMASMABBmid[i] = _bbands.Main[i];
                outQMASMABBdn[i] = _bbands.Bottom[i];
            }
        }
    }
}

mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mBBos.algo
  • Rating: 5
  • Installs: 814
  • Modified: 02/02/2023 19:13
Comments
Log in to add a comment.
No comments found.