Midnight datetime is not good for my TimeZone

Created at 05 Mar 2018, 23:32
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!
alexander.n.fedorov's avatar

alexander.n.fedorov

Joined 02.01.2018

Midnight datetime is not good for my TimeZone
05 Mar 2018, 23:32


 

 

Dear Pangiotis,

I have the folowing for timing of the cBot on H1 timeframe

"

..

    [Robot(TimeZone = TimeZones.RussianStandardTime, AccessRights = AccessRights.None)]
    public class DailyRange : Robot

...

        [Parameter("Time Frame 2", DefaultValue = "Daily")]
        public TimeFrame TimeFrame2 { get; set; }

...

 private MarketSeries SeriesMain;

...

  SeriesMain = MarketData.GetSeries(TimeFrame2);

...

 today = SeriesMain.OpenTime.LastValue.Date;

        protected override void OnBar()
        {
            newDate = MarketSeries.OpenTime.LastValue.Date;

...

            Expiry = SeriesMain.OpenTime.Last(0);
            Expiry = Expiry.AddHours(23);
            Expiry = Expiry.AddMinutes(-5);
            Print("OnStart: today = {0},  tomorrow = {1}, newDate ={2} ; orders expiry = {3} ", today, tomorrow, newDate, Expiry);

...

"

But after the midnight I am still getting the print message like:

06/03/2018 00:20:29.620 | OnStart: today = 05.03.2018 00:00:00 ,  tomorrow = 06.03.2018 00:00:00 , newDate =01.01.0001 00:00:00  ; orders expiry = 05.03.2018 23:55:00  

 

Is there something that I am missing?

How come the date from a system and the date from the Bot are different.

I need at after midnight to reinitialize the Bot, what  shall I do?


@alexander.n.fedorov
Replies

alexander.n.fedorov
05 Mar 2018, 23:39

Midnight datetime is not good for my TimeZone

The Bot has to place orders at midnight but instead, as expected after the said above, it gives an error message smth like "Bad epxpiry date"

 

 


@alexander.n.fedorov

alexander.n.fedorov
06 Mar 2018, 00:14

Midnight datetime is not good for my TimeZone

Everything started to work fine after 1 am

 


@alexander.n.fedorov