Category Trend  Published on 02/07/2020

Adaptive Zig Zag (AZZ)

Description

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

Download

 

 

 

 


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 
        //
        // https://gum.co/divergencepro

        private string title = "Adaptive Zig Zag";
        private string url = "https://gum.co/adaptivezigzag";


        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
            };
            container.AddChild(button);

            Chart.AddControl(background);
            Chart.AddControl(container);

            Print(title);
            Print(url);
        }

        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
diiptrade

Joined on 17.11.2016

  • Distribution: Paid
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Adaptive Zig Zag Start.algo
  • Rating: 0
  • Installs: 1288
Comments
Log in to add a comment.
diiptrade's avatar
diiptrade · 3 years ago

you are so observant)