MarketSeries.OpenTime Bug

Created at 31 Jan 2018, 23:10
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!
M.

m.bister

Joined 31.01.2018

MarketSeries.OpenTime Bug
31 Jan 2018, 23:10


Maybe I am bugging, but suspect something is wrong here, the MarketSeries.OpenTime does never seem to be a Friday. Please advise if this is expected or if I made an incorrect assumption about the OpenTime value?

Code:

On the Dax it gives the following output

Thanks. 

Complete code:

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class BugDemo : Robot
    {
        private bool didWeEverHaveFriday = false;

        protected override void OnBar()
        {
            
            //Print(MarketSeries.OpenTime.LastValue.Date.DayOfWeek + " " + MarketSeries.OpenTime.LastValue.Date.ToShortDateString());
            if (MarketSeries.OpenTime.LastValue.DayOfWeek == DayOfWeek.Sunday)
            {
                Print("Trading Sunday");
            }

            if (MarketSeries.OpenTime.LastValue.DayOfWeek == DayOfWeek.Friday)
            {
                didWeEverHaveFriday = true;
            }
        }

        protected override void OnStop()
        {
            if (!didWeEverHaveFriday)
            {
                Print("Is Market Closed on every Friday");
            }
        }
    }
}

@m.bister
Replies

PanagiotisCharalampous
01 Feb 2018, 09:53

Hi m.bister,

Thanks for posting in our forum. What timeframe do you use for your backtesting?

Best Regards,

Panagiotis


@PanagiotisCharalampous

m.bister
01 Feb 2018, 12:00

It was produced using the daily chart. 

 


@m.bister

PanagiotisCharalampous
01 Feb 2018, 12:08

Hi m.bister,

If you use the Daily chart then the result is correct. There is no opening time on Friday. The daily bar opens at 22:00 on Thursday, UTC time. The next opening time is at 22:00 on Sunday.

Best Regards,

Panagiotis


@PanagiotisCharalampous

m.bister
01 Feb 2018, 12:09

Thanks, for the prompt reply, was a bug with me. 


@m.bister