OnTick() How to get Tick TimeStamp?

Created at 04 Nov 2015, 03:04
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!
LU

lukepoga

Joined 15.10.2015

OnTick() How to get Tick TimeStamp?
04 Nov 2015, 03:04


So the basic definition for any Tick is Bid,Ask and TimeStamp. Timestamp is the UTC time on the server when the tick occured, in milliseconds since 1970/01/01.

I can use Symbol.Bid and Symbol.Ask, but there is no Symbol.TimeStamp! How do i get the time the tick occured on the server?(note - not the time on the client!)

 

 

 


@lukepoga
Replies

Spotware
04 Nov 2015, 03:20

Dear Trader,

You could use the Server.Time method. The following code snippet illustrates an example of printing the server time right after the tick occurred:

protected override void OnTick()
{
    Print("The server time is: {0}", Server.Time);
}

 


@Spotware

lukepoga
04 Nov 2015, 06:05

Thanks. How often is Server.Time updated? Does it come in the tick packet from the server or is it simulated from somewhere else?

 


@lukepoga

mindbreaker
04 Nov 2015, 13:05

RE:
using System.Text;
using System.Threading.Tasks;

namespace Tuts_Time
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true) {
               
               //  miliseconds
                int m = DateTime.UtcNow.Millisecond;

                Console.WriteLine(m);
            }
        }
    }
}

https://msdn.microsoft.com/pl-pl/library/system.datetime.millisecond%28v=vs.110%29.aspx


@mindbreaker