Adaptive Price Channel (APC) paid

by diiptrade in category Trend at 02/07/2020

The APC are based on the average difference between the Lowest Low and Highest High over a selected multiplier of number of intervals, therefore they tend to be associated with potential areas of support or resistance. Unlike classic Price Channel, the APC do not tend to narrow during periods of sideways trading and price consolidation, typically before a breakout.

The APC can be used to identify trend reversals or overbought/oversold levels that denote pullbacks within a bigger trend. A surge above the upper channel line shows extraordinary strength that can signal the start of an uptrend. Conversely, a plunge below the lower channel line shows serious weakness that can signal the start of a downtrend.




Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
´╗┐using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
    [Indicator(TimeZone = TimeZones.UTC, IsOverlay = true)]
    public class DivergenceStart : Indicator
        // Please download this indicator from 

        private string title = "Adaptive Price Channel";
        private string url = "";

        protected override void Initialize()
            string buttonText = "Download " + title;
            Color backgroundColor = Application.ColorTheme == ColorTheme.Dark ? GetColorWithOpacity(Color.FromHex("#292929"), 0.85m) : GetColorWithOpacity(Color.FromHex("#FFFFFF"), 0.85m);

            var background = new Rectangle 
                Height = Chart.Height,
                Width = Chart.Width,
                FillColor = backgroundColor

            var button = new Button 
                Text = buttonText,
                Padding = "16",
                Style = ButtonStyle(Color.FromHex("#009345"), Color.FromHex("#10A651"))
            button.Click += e => System.Diagnostics.Process.Start(url);
            var container = new StackPanel 
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center



        public override void Calculate(int index)


        private Style ButtonStyle(Color color, Color hoverColor)
            var style = new Style(DefaultStyles.ButtonStyle);
            style.Set(ControlProperty.BackgroundColor, color, ControlState.DarkTheme);
            style.Set(ControlProperty.BackgroundColor, color, ControlState.LightTheme);
            style.Set(ControlProperty.BackgroundColor, hoverColor, ControlState.DarkTheme | ControlState.Hover);
            style.Set(ControlProperty.BackgroundColor, hoverColor, ControlState.LightTheme | ControlState.Hover);
            style.Set(ControlProperty.ForegroundColor, Color.FromHex("#FFFFFF"), ControlState.DarkTheme);
            style.Set(ControlProperty.ForegroundColor, Color.FromHex("#FFFFFF"), ControlState.LightTheme);
            return style;

        private Color GetColorWithOpacity(Color baseColor, decimal opacity)
            var alpha = (int)Math.Round(byte.MaxValue * opacity, MidpointRounding.AwayFromZero);
            return Color.FromArgb(alpha, baseColor);