Load More History for GetTicks()

Created at 10 Aug 2020, 00: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!
Waxy's avatar

Waxy

Joined 12.05.2015

Load More History for GetTicks()
10 Aug 2020, 00:11


Hello, 

I'd like to know if it's possible to get more ticks than the MarketData.GetTicks() method does.

Since I don't have an equivalent of LoadMoreHistory() for ticks, I tried with the following, doesn't work

            Print(string.Format("First Open Time {0}", Bars.First().OpenTime));
            Print(string.Format("First Tick {0}", MarketData.GetTicks().First().Time));
            Print("Loading More History");
            Bars.LoadMoreHistory();
            Print(string.Format("First Open Time {0}", Bars.First().OpenTime));
            Print(string.Format("First Tick {0}", MarketData.GetTicks().First().Time));

09/08/2020 20:54:44.593 | First Tick 8/7/2020 1:57:01 PM
09/08/2020 20:54:44.593 | First Open Time 2/12/2020 4:00:00 AM
09/08/2020 20:54:44.249 | Loading More History
09/08/2020 20:54:44.249 | First Tick 8/7/2020 1:57:01 PM
09/08/2020 20:54:42.140 | First Open Time 4/20/2020 5:00:00 AM
 

Thanks for your support


@Waxy
Replies

GridSurfer
10 Aug 2020, 23:22

RE:

Hi Waxy,

you just need to repeat the LoadMoreHistory() until you have enough history data.

API.Ticks symbolTicks;
DateTime firstDt = new DateTime(2020, 8, 1);

symbolTicks = MarketData.GetTicks();
while (symbolTicks[0].Time.CompareTo(firstDt) > 0)
{
     symbolTicks.LoadMoreHistory();
}

Maybe Panagiotis will post the snipplet in the API-Reference. I was looking for it before as well.

Cheers
GridSurfer


@GridSurfer

Waxy
11 Aug 2020, 02:55

RE: RE:

GridSurfer said:

Hi Waxy,

you just need to repeat the LoadMoreHistory() until you have enough history data.

API.Ticks symbolTicks;
DateTime firstDt = new DateTime(2020, 8, 1);

symbolTicks = MarketData.GetTicks();
while (symbolTicks[0].Time.CompareTo(firstDt) > 0)
{
     symbolTicks.LoadMoreHistory();
}

Maybe Panagiotis will post the snipplet in the API-Reference. I was looking for it before as well.

Cheers
GridSurfer

Thank you,

This works!

 


@Waxy