Category Trend  Published on 20/12/2021

Projection Bands

Description

Projection Bands were developed by Mel Widner, Ph.D and were introduced in an Technical Analysis of Stocks & Commodities magazine article in July, 1995.

Projection Bands are made up of two bands outlining minimum and maximum projected boundaries. The Bands are derived using the minimum and maximum prices over a given time period and projecting these forward, parallel to a linear regression line. The Bands are interpreted to signal directional price reversal when when prices reaches their boundary.

 

Github: GitHub - Doustzadeh/cTrader-Indicator

 


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

namespace cAlgo
{
    [Indicator(IsOverlay = true, AutoRescale = false, AccessRights = AccessRights.None)]
    public class ProjectionBands : Indicator
    {
        [Parameter("Periods", DefaultValue = 14)]
        public int Periods { get; set; }

        [Output("HiBand", LineColor = "DodgerBlue")]
        public IndicatorDataSeries HiBand { get; set; }

        [Output("LowBand", LineColor = "Red")]
        public IndicatorDataSeries LowBand { get; set; }

        private LinearRegressionSlope LrsHigh, LrsLow;

        protected override void Initialize()
        {
            LrsHigh = Indicators.LinearRegressionSlope(Bars.HighPrices, Periods);
            LrsLow = Indicators.LinearRegressionSlope(Bars.LowPrices, Periods);
        }

        public override void Calculate(int index)
        {
            HiBand[index] = Bars.HighPrices[index];
            LowBand[index] = Bars.LowPrices[index];

            for (int i = 1; i < Periods; i++)
            {
                HiBand[index] = Math.Max(HiBand[index], Bars.HighPrices.Last(i) + i * LrsHigh.Result[index]);
                LowBand[index] = Math.Min(LowBand[index], Bars.LowPrices.Last(i) + i * LrsLow.Result[index]);
            }
        }
    }
}


Doustzadeh's avatar
Doustzadeh

Joined on 20.03.2016

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Projection Bands.algo
  • Rating: 0
  • Installs: 1098
  • Modified: 19/12/2021 23:40
Comments
Log in to add a comment.
MA
markspencer943 · 1 year ago

Thanks for sharing this best stuff with us! Keep sharing! I am new in blog writing. All types of blogs and posts are not helpful for the readers. Here the author is giving good thoughts and suggestions to each and every reader through this article.i need an assignment literature essay Quality of the content is the main element of the blog and this is the way of writing and presenting.

AD
adilahbisar · 2 years ago

Coding is hard but some people do it from the heart and make the best tools for the people. The professional resume writers of perfect CVs are researching to make the best mobile application.