Server.Time.Hour NOT working for Backtest

Created at 07 Apr 2021, 16:31
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!
TR

triccomane

Joined 07.04.2021

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


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 :)


@triccomane
Replies

amusleh
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.


@amusleh

triccomane
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.


@triccomane

amusleh
07 Apr 2021, 18:03 ( Updated at: 21 Dec 2023, 09:22 )

Hi,

You can select the tick data here:


@amusleh