Server.Time.Hour NOT working for Backtest

triccomane since: 07 Apr 2021;

  07 Apr 2021, 16:31
Server.Time.Hour NOT working for Backtest

Hi, I do not understand how to make this work. The code works only when the current time of the server is equal to parameters accepted by the code. It does not make sense that the backtest takes into consideration the current server time and not the time in the backtest data.

        protected override void OnTick()
        {
            // Print("");

            if (Server.Time.Hour > 9 && Server.Time.Hour < 10 && Server.Time.Minute == 1)
            {
                Print("--------");
                var highest = Bars.HighPrices;
                Print("highest ", highest);
            }

Thanks in advance to anyone willing to help :)

amusleh's avatar

amusleh since: 01 Mar 2021;

  07 Apr 2021, 17:21

The server time is based on back test data time not current time of server.

The code inside if block will only run if the server time is equal to 9:01, and for that to work you have to use the tick data for back test not bar data.

Community Developer | Spotware

triccomane since: 07 Apr 2021;

  07 Apr 2021, 17:55
RE:

amusleh said:

The server time is based on back test data time not current time of server.

The code inside if block will only run if the server time is equal to 9:01, and for that to work you have to use the tick data for back test not bar data.

thanks for answering. How do I do that I cannot find a way to get tick data instead of bar data. What I'm trying to do is to get the high of the 9:00 candle.

amusleh's avatar

amusleh since: 01 Mar 2021;

  07 Apr 2021, 18:03

Hi,

You can select the tick data here:

Community Developer | Spotware