GO TO DATE

cTrader
5
Votes

richardkurta since: 23 Dec 2018;

  24 Oct 2020, 22:55
GO TO DATE

It will be great to have option "GO TO DATE" to move chart back in time. Now its is possible only by moving mouse.

cranmer767 since: 05 Nov 2019;

  01 Nov 2020, 17:49
RE:

richardkurta said:

It will be great to have option "GO TO DATE" to move chart back in time. Now its is possible only by moving mouse.

I definitely agree and support this simple request. Most quality trading and software packages offer this feature yet cTrader/Spotware seem incapable or indifferent to offering it despite all the requests.

PanagiotisCharalampous's avatar

PanagiotisCharalampous since: 13 Jan 2017;

  02 Nov 2020, 08:31

Hi cranmer767,

This functionality can be easily coded by the community. See a cBot example below

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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ScrollTo : Robot
    {
        [Parameter(DefaultValue = 2014)]
        public int Year { get; set; }

        [Parameter(DefaultValue = 1)]
        public int Month { get; set; }

        [Parameter(DefaultValue = 1)]
        public int Day { get; set; }

        protected override void OnStart()
        {
            var date = new DateTime(Year, Month, Day);

            while (Bars.OpenTimes[0] > date)
                Bars.LoadMoreHistory();
            Chart.ScrollXTo(date);
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Best Regards,

Panagiotis 

Join us on Telegram

Head of Community Management at cTrader

cranmer767 since: 05 Nov 2019;

  05 Nov 2020, 15:15
RE:

PanagiotisCharalampous said:

Hi cranmer767,

This functionality can be easily coded by the community. See a cBot example below

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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ScrollTo : Robot
    {
        [Parameter(DefaultValue = 2014)]
        public int Year { get; set; }

        [Parameter(DefaultValue = 1)]
        public int Month { get; set; }

        [Parameter(DefaultValue = 1)]
        public int Day { get; set; }

        protected override void OnStart()
        {
            var date = new DateTime(Year, Month, Day);

            while (Bars.OpenTimes[0] > date)
                Bars.LoadMoreHistory();
            Chart.ScrollXTo(date);
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

Many thanks for the reply. Would prefer that it was available on current charts.

Best regards,

Carr