Load chart-view for a particular date (fast-load) !

Created at 14 Jul 2020, 12:43
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
MA

mark.lite

Joined 03.07.2019

Load chart-view for a particular date (fast-load) !
14 Jul 2020, 12:43


It takes ages to scroll down a tick-chart or a minute chart to an older date like 1 year ago+

  • Please add a feature in drop-down menu on chart to jump to a particular date!

 

Support please :)


cTrader
@mark.lite
Replies

PanagiotisCharalampous
14 Jul 2020, 12:46

Hi mark.lite,

You might find this cBot useful

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

 


@PanagiotisCharalampous