NPlot.TradingDateTimeAxis.WithinTradingHours C# (CSharp) Method

WithinTradingHours() public method

Check whether the given coordinate falls within defined trading hours.
public WithinTradingHours ( double coord ) : bool
coord double world coordinate in ticks to check.
return bool
        public bool WithinTradingHours(double coord)
        {
            long ticks = (long)coord;
            long whole_days = ticks / TimeSpan.TicksPerDay;
            long ticks_in_last_day = ticks % TimeSpan.TicksPerDay;
            long days_in_last_week = whole_days % 7;
            if (days_in_last_week >= 5)
                return false;

            if (ticks_in_last_day < startTradingTime_) return false;
            if (ticks_in_last_day >= endTradingTime_) return false;

            return true;
        }