Category Trend  at 02/07/2020

Adaptive Zig Zag (AZZ)


The AZZ indicator plots points on the chart whenever prices reverse by a percentage greater than an average height of the Adaptive Price Channel. Straight lines are then drawn, connecting these points. 

AZZ lines only appear when there is a price movement between a swing high and a swing low that is greater than an average price channel height.

The indicator is used to help identify price trends. It eliminates random price fluctuations and attempts to show trend changes.

The AZZ indicator helps to identify potential support and resistance zones between plotted swing highs and swing lows. 

AZZ lines can also reveal reversal patterns, i.e. double bottoms and head and shoulders tops.

Required: Adaptive Price Channel






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 Zig Zag";
        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);

diiptrade's avatar

Joined 17.11.2016

  • Type: Paid
  • Language: C#
  • Trading Platform: cTrader Automate
  • Filename: Adaptive Zig Zag Start.algo
  • Rating: 0
  • Downloads: 1288
Only logged in users can post a comment
diiptrade's avatar
RV · 3 years ago

you are so observant)