server time in the future

Created at 18 Oct 2022, 12:00
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!
EY

eynt

Joined 08.05.2020

server time in the future
18 Oct 2022, 12:00


Hello

When calling the Time property which supposed to return current server time, I get a time in the future (usually somewhere in December 22) which of course cannot be.

I've added a simple bot to illustrate that problem. You can run it on several symbols (for me it happened on EURUSD h1 and BTCUSD h1) and usually within several minutes/hours you will get this error.

 

Thank you

 

 

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class TimeDiffTester : Robot
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        protected override void OnStart()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate

            Print(Message);
        }

        protected override void OnTick()
        {
            DateTime serverTime = Time;
            DateTime localTime = DateTime.Now;
            double timeDiff = serverTime.Subtract(localTime).TotalDays;

            if (timeDiff > 1)
            {
                Print("timeDiff > 1");
                Print("serverTime= " + serverTime);
                Print("localTime=" + localTime);
                Print("timeDiff= " + timeDiff);
                Stop();
            }
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
    }
}

 


@eynt
Replies

eynt
19 Oct 2022, 10:13

RE:

Hello

Where you able to reproduce the bug?


@eynt

eynt
20 Oct 2022, 10:07

RE: RE:

I wanted to add that the problem occurs on more than one broker so it's not a broker issue

 


@eynt

Spotware
20 Oct 2022, 10:15

Dear yuval.ein,

We were not able to reproduce the problem in the latest version of cTrader. Can you please clarify which version you are using?

Best regards,

cTrader Team


@Spotware

eynt
20 Oct 2022, 12:17

RE:

Hello

one is 4.2.22.8460 and the other is 4.2.22.8451.

Please try to run the sample bot on as much symbols as possible so it will make the process of reproducing the bug as fast as possible. You can try to run the cBot for a few days to be sure although for me it took no more than a few hours.

My cTrader is configured as UTC+3 perhaps it's related.

Thanks

 


@eynt

Spotware
20 Oct 2022, 13:34

Dear yuval.ein,

This issue was fixed in later versions. You can use cross broker cTrader 4.4 instead.

Best regards,

cTrader Team


@Spotware

eynt
20 Oct 2022, 13:46

RE:

What is cross broker cTrader and how can I download the latest version?

thanks

 


@eynt

Spotware
20 Oct 2022, 14:10

RE: RE:

Dear yuval.ein,

You can download it here. You should be able to connect to all your brokers accounts.

Best regards,

cTrader Team


@Spotware

eynt
20 Oct 2022, 16:00

RE: RE: RE:

Thank you

a. Will show me the exact data as my brokers (there are small differences between different brokers/data providers)?

b. Is there a way to upgrade my brokers cTraderes or do I have to wait for it to be upgraded automatically?

 


@eynt

Spotware
21 Oct 2022, 08:48

Dear yuval.ein,

a. Yes

b. You have to wait

Best regards,

cTrader Team


@Spotware