Category Trend  Published on 05/07/2020

Divergence Lite

Description

The indicator recognizes the divergences and shows it on your chart and technical indicator. The divergence recognition algorithm is very powerful and accurate. 

The indicator shows the same divergence on both your candlestick price chart and indicator window.

The following indicators of divergence are included in Divergence Lite bundle:

- MACD

- RSI

Support: If you have any question or issue with the product please contact me via telegram.

Download: [https://gum.co/divergencelite]

 

 

 

 

 


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

namespace cAlgo.Indicators
{
    [Indicator(TimeZone = TimeZones.UTC, IsOverlay = true)]
    public class DivergenceLiteStart : Indicator
    {
        // Please download this indicator from 
        //
        // https://gum.co/divergencelite

        private string title = "Adaptive Price Channel";
        private string url = "https://gum.co/divergencelite";


        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: Divergence Lite Start.algo
  • Rating: 5
  • Installs: 1908
Comments
Log in to add a comment.
TG
tgjobscv · 4 years ago

You can make divergence in the averenge indicator ?

https://ctrader.com/algos/indicators/show/2048#comment-5596