Category Oscilators  Published on 20/12/2021

Projection Bandwidth

Description

Projection Bands, a new method using trading bands, projects market data forward along the data trend with the maximum and minimum of the projections defining the band. The method provides another means of signaling potential changes for market direction relative to the trend.

This shows the % width of the projection bands. A trend reversal is signaled by a high value. Low value may indicate the start of a new trend. This is also a trend strength indicator.

 

Github: GitHub - Doustzadeh/cTrader-Indicator

 


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

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

        [Output("BW", LineColor = "Red")]
        public IndicatorDataSeries BW { 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)
        {
            double HiBand = Bars.HighPrices[index];
            double LowBand = Bars.LowPrices[index];

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

            BW[index] = 200 * (HiBand - LowBand) / (HiBand + LowBand);
        }
    }
}


Doustzadeh's avatar
Doustzadeh

Joined on 20.03.2016

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Projection Bandwidth.algo
  • Rating: 0
  • Installs: 1103
  • Modified: 19/12/2021 23:46
Comments
Log in to add a comment.
RE
reed44572 · 2 years ago

After looking through 5 Reasons to Get Prepared for the College Exam, I’ve decided to change my attitude to studies. A good motivation is what I really needed, and I found it there.