exact time ofTick/Bar

Created at 10 Jul 2018, 17:30
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!
CE

ceakuk

Joined 19.03.2018

exact time ofTick/Bar
10 Jul 2018, 17:30


I'm creating a custom renko and to avoid trading on the volatile late Friday- early Monday period, I would like to paint bricks created between 18:00 oclock on Friday and 06:00 oclock on Monday with a different color how can i get exact time every int index

public override void Calculate(int index)
        {
// Exact time per index ?
}
//My solution

trading = true;
if (MarketSeries.OpenTime.LastValue.DayOfWeek == DayOfWeek.Monday)
{
       if(MarketSeries.OpenTime.LastValue.TimeOfDay.TotalHours < 6)
        trading = false;
}

else if (MarketSeries.OpenTime.LastValue.DayOfWeek == DayOfWeek.Friday)
{
    if(MarketSeries.OpenTime.LastValue.TimeOfDay.TotalHours > 18)
   trading = false;
}

 

MarketSeries.OpenTime is just for the time  the market series is created
Server.Time.DayOfWeek only works with cbot but not indicator
Any help with be highly appreciated. Thanks in advance

@ceakuk
Replies

PanagiotisCharalampous
16 Jul 2018, 14:35

Hi ceacuk,

Is there a reason that OpenTime does not work for you?

Best Regards,

Panagiotis


@PanagiotisCharalampous