m1 search option?

Created at 30 Dec 2021, 12:11
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!
ZY

zytotoxiziteat

Joined 04.08.2021

m1 search option?
30 Dec 2021, 12:11


Hi, when I use the m1 timeframe and want to go way back, say to the 01.01.2019, for analyzing purposes I have to scroll tirelessly for half an hour to the left. is there a way to do it faster?

Like a search option where I can enter a date in the m1 timeframe and cTrader will scroll automatically to exactly that point of time? 

 

Thanks a lot

 

doni


@zytotoxiziteat
Replies

PanagiotisCharalampous
30 Dec 2021, 15:30

Hi doni,

There is no built in feature unfortunately. Try the cBot below instead

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 and Facebook


@PanagiotisCharalampous

zytotoxiziteat
31 Dec 2021, 09:47

RE:

Hi, Thank you so much,

 

I have copy pasted your code to the algo bot and it says "Build succeeded" but I have no idea how to actually use it. Sorry I have never used bots... is there a manual how I get this thing started?


@zytotoxiziteat

PanagiotisCharalampous
31 Dec 2021, 09:55

Hi doni,

You can start from here. Regarding the specific cBot, just enter the date you want to scroll back to and press Play.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

zytotoxiziteat
31 Dec 2021, 10:34

RE:

PanagiotisCharalampous said:

Hi doni,

You can start from here. Regarding the specific cBot, just enter the date you want to scroll back to and press Play.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Awesome!

Thank you very much


@zytotoxiziteat