Hello There How to gets Tick index in a specific time and Date ?

Created at 04 Jan 2021, 07:01
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!
IM

imrealfighter

Joined 09.11.2020

Hello There How to gets Tick index in a specific time and Date ?
04 Jan 2021, 07:01


Hello There I'm new a Cbot so need some help from you guys 

Is there a way that we could get an index of a tick from a specific date and time. 

as always I tried to search on my own and it shows Ticks interface that if could call this[index] to get a tick at a specific point. but how do we know it's index number?

 

Assume that we want to consider a tick on this 2021.01.04  (years, month, date) at 07.00 how do we get an index of a tick at that time 

thank you.  


@imrealfighter
Replies

PanagiotisCharalampous
04 Jan 2021, 09:55

Hi imrealfighter,

There is no built-in method for this, you will need to write your own.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

imrealfighter
04 Jan 2021, 14:36

RE:

PanagiotisCharalampous said:

Hi imrealfighter,

There is no built-in method for this, you will need to write your own.

Best Regards,

Panagiotis 

Join us on Telegram

Thank you PanagiotisCharalampous I will try to. 


@imrealfighter

imrealfighter
04 Jan 2021, 15:59 ( Updated at: 04 Jan 2021, 16:31 )

RE:

PanagiotisCharalampous said:

Hi imrealfighter,

There is no built-in method for this, you will need to write your own.

Best Regards,

Panagiotis 

Join us on Telegram

Hello There again PanagiotisCharalampous need a little bit of helping here if you don't mind. (Solved) !

.........Edit now I've problem solved 
I declare Variable outside the method and then on Onstart() I set it's value and Call to to take action when it load more historical tick data.  

as begins ctrader provide us around thousand ticks but I try to test more than that so I find method and class on API that support to load more tick I found this class  TicksHistoryLoadedEventArgs and it provides new Count and a new set of Ticks data how can I get this Count and set of Ticks data to use? 

this is my method for now 
TIcks ticksOfMarket = MarketData.GetTicks();

and I call ticksOfMarket.LoadMoreHistory();
so when we call LoadMoreHistory() method 

TicksHistoryLoadedEventArgs will occur right and 

on Ticks we have Ticks.HistoryLoaded to take action 
I write Ticks.HistoryLoaded on OnStart() and when come to build CBot it says 

An object reference is required for the non-static field, method, or property 'cAlgo.API.TIcks.HistoryLoaded' that's it 



I try my best but there is no example with this so hope you could give me some suggestion on this. 

.........Edit now I've problem solved 
I declare Variable outside the method and then on Onstart() I set it's value and Call to to take action when it load more historical tick data.  

 

Thank you.


@imrealfighter

imrealfighter
04 Jan 2021, 16:29 ( Updated at: 04 Jan 2021, 16:32 )

 

Same Content as Above


@imrealfighter