how to get the datetime of current tick?

Created at 18 Jul 2014, 18:37
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!
TO

TonyPro

Joined 18.07.2014

how to get the datetime of current tick?
18 Jul 2014, 18:37


I'm developing a cBot. I need to know the datetime of each tick. But the only time related property I find is MarketSeries.OpenTime, which is not what I need. so how to get the current tick datetime in OnTick() method? If I use the C# function DateTime.UtcNow, I can get the current computer datetime, but it will be a wrong dateime if I use it in backtesting. Because every tick will be current computer time. and they are all the same time.


@TonyPro
Replies

TonyPro
18 Jul 2014, 19:28

RE:

TonyPro said: I have fix this by using 'Server.Time', but how to get the current tick price?

I'm developing a cBot. I need to know the datetime of each tick. But the only time related property I find is MarketSeries.OpenTime, which is not what I need. so how to get the current tick datetime in OnTick() method? If I use the C# function DateTime.UtcNow, I can get the current computer datetime, but it will be a wrong dateime if I use it in backtesting. Because every tick will be current computer time. and they are all the same time.

 


@TonyPro

Antonma
19 Jul 2014, 01:08

Hi,

there is no tick price. You can use Symbol.Bid and Symbol.Ask on the tick event. Some people use (Bid+Ask)/2 in order to get the current price...

Regards,

Anton

 


@Antonma

TonyPro
19 Jul 2014, 03:14

RE:

Thank you very much! it's really helpful

Antonma said:

Hi,

there is no tick price. You can use Symbol.Bid and Symbol.Ask on the tick event. Some people use (Bid+Ask)/2 in order to get the current price...

Regards,

Anton

 

 


@TonyPro