Category Volatility  Published on 26/07/2020

Bollinger Bands - Distance From Bottom

Description

Similar to earlier indicator on Distance from top, this Indicators says how much distance price is there from the Bottom bar. Pretty simple calculation (Price - Bottom)

But, when you add that to 100 period distance comparison you will get to know when it has hit the bottom and when it has hit the top. This will help identifying double top patterns even when close price is not crossing Bollinger Bands Top.

To make it simple:

1. Sell when Yellow line of distance has just left the top green line.

2. Buy when Yellow line of distance has just left the bottom red line.

 

 

 

Check my other indicators:

 


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

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class BBBottomDistance : Indicator
    {
        [Parameter("Period", DefaultValue = 20)]
        public int Period { get; set; }

        [Parameter("SD Weight Coef", DefaultValue = 2)]
        public double K { get; set; }

        [Parameter("MA Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType MaType { get; set; }

        [Parameter("High/Low Period", DefaultValue = 20)]
        public int HighLowPeriod { get; set; }

        [Parameter()]
        public DataSeries Source { get; set; }

        private BollingerBands _bollingerBands;

        [Output("LowDistance", LineColor = "yellow", Thickness = 1)]
        public IndicatorDataSeries Distance { get; set; }


        [Output("Low", LineColor = "red", Thickness = 3)]
        public IndicatorDataSeries Low { get; set; }

        [Output("High", LineColor = "green", Thickness = 3)]
        public IndicatorDataSeries High { get; set; }


        protected override void Initialize()
        {
            _bollingerBands = Indicators.BollingerBands(Source, Period, K, MaType);
        }

        public override void Calculate(int index)
        {
            Distance[index] = (Bars.ClosePrices[index] - _bollingerBands.Bottom[index]);

            int backCalculationIndex = Math.Min(HighLowPeriod, Distance.Count);
            High[index] = Low[index] = Distance[index];
            for (int i = 0; i < backCalculationIndex; i++)
            {
                High[index] = (Distance[index - i] > High[index]) ? Distance[index - i] : High[index];
                Low[index] = (Distance[index - i] < Low[index]) ? Distance[index - i] : Low[index];
            }
        }
    }
}


VO
voldemort

Joined on 10.07.2020

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: BBBottomDistance.algo
  • Rating: 0
  • Installs: 1472
Comments
Log in to add a comment.
No comments found.