Paginator free

by devman in category Other at 21/07/2022
Description

 Paginator Tool for cTrader 4.2+

Parameters

How to use: just add it as a regular indicator.

Feel free to make your suggestions to improve this indicator!

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;

namespace devman
{
    [Indicator(AccessRights = AccessRights.None, IsOverlay = true)]
    public class Paginator : Indicator
    {
        [Parameter(DefaultValue = VerticalAlignment.Bottom)]
        public VerticalAlignment VerticalAlignment { get; set; }

        [Parameter(DefaultValue = HorizontalAlignment.Center)]
        public HorizontalAlignment HorizontalAlignment { get; set; }
        
        [Parameter(DefaultValue = 11)]
        public int FontSize { get; set; }

        private DateTime ActualOpenTime => Bars[Chart.FirstVisibleBarIndex].OpenTime;

        protected override void Initialize()
        {
            Chart.AddControl(CreateNavigationPanel());
        }

        public override void Calculate(int index)
        {
            // DO NOTHING
        }

        private StackPanel CreateNavigationPanel()
        {
            var panel = new StackPanel
            {
                VerticalAlignment = VerticalAlignment,
                HorizontalAlignment = HorizontalAlignment,
                Orientation = Orientation.Horizontal,
                Margin = 10,
            };

            var navBtnStyle = new Style(DefaultStyles.ButtonStyle);
            navBtnStyle.Set(ControlProperty.Margin, new Thickness(1, 0, 1, 0));
            navBtnStyle.Set(ControlProperty.FontSize, FontSize);

            var b0 = new Button { Text = "◀◀", Style = navBtnStyle };
            b0.Click += _ => Chart.ScrollXTo(0);

            var bY = new Button { Text = "◀◀ Y", Style = navBtnStyle };
            bY.Click += _ => NavigateTo(ActualOpenTime.AddYears(-1));

            var bM = new Button { Text = "◀◀ M", Style = navBtnStyle };
            bM.Click += _ => NavigateTo(ActualOpenTime.AddMonths(-1));

            var bD = new Button { Text = "◀ D", Style = navBtnStyle };
            bD.Click += _ => NavigateTo(ActualOpenTime.AddDays(-1));

            var fD = new Button { Text = "D ▶", Style = navBtnStyle };
            fD.Click += _ => NavigateTo(ActualOpenTime.AddDays(1));

            var fM = new Button { Text = "M ▶▶", Style = navBtnStyle };
            fM.Click += _ => NavigateTo(ActualOpenTime.AddMonths(1));

            var fY = new Button { Text = "Y ▶▶", Style = navBtnStyle };
            fY.Click += _ => NavigateTo(ActualOpenTime.AddYears(1));

            var f0 = new Button { Text = "▶▶", Style = navBtnStyle };
            f0.Click += _ => Chart.ScrollXTo(Bars.Count);

            panel.AddChild(b0);
            panel.AddChild(bY);
            panel.AddChild(bM);
            panel.AddChild(bD);
            panel.AddChild(fD);
            panel.AddChild(fM);
            panel.AddChild(fY);
            panel.AddChild(f0);

            return panel;
        }

        private void NavigateTo(DateTime time)
        {
            var indexByTime = Bars.OpenTimes.GetIndexByTime(time);

            if (indexByTime < 0)
                indexByTime = 0;

            Chart.ScrollXTo(indexByTime);
        }
    }
}
Comments

lenkalee266 - July 23, 2022 @ 09:39

 Nerdle game online thanks for sharing this article. I am glad to see this amazing post.

emmawatsonsp2 - July 26, 2022 @ 06:20

I appreciate the information friday night funkin and advice you have shared. 

nobit2021 - August 02, 2022 @ 05:49

This is something I've discussed with a friend. Run 3 is an addicting infinite runner game set in a futuristic universe in which you control a self-falling ball on a 3D track, combining old and new gameplay elements. A fast-paced game with some bizarre high-tech elements.

johntin246 - August 10, 2022 @ 14:41

A complete and well maintain code. I am also a web developer and need that codes to integrate in my website. currently i am working with michael jackson outfits. they have been doing great since they launched their first website.

charlessyarborough - August 31, 2022 @ 18:12

This device is a portable, mechanical, and electric device that helps you quickly turn the pages of a book without the need to move your hands. It is light and easy to carry, so you can bring it with you anywhere. It's perfect for when you're reading a book in bed and listing images amazon. It also has a built-in magnifier that allows you to read small print without having to strain your eyes. This device is also useful when you're cooking and need to read a recipe without dirtying your hands.

junealexis001 - September 12, 2022 @ 12:03

Awesome  site i love it keep posting more!   https://fencingfortwaynein.com

5