Exemple #1
0
        internal KeyValuePair <Key, double>?LastEventWhenMore(Key to, double threshold)
        {
            if (Predicates.Less(to, From))
            {
                return(null);
            }
            if (Maximum <= threshold)
            {
                return(null);
            }
            KeyValuePair <Key, double>?result = null;

            if ((null != FirstChild) && (null != SecondChild))
            {
                result = SecondChild.LastEventWhenMore(to, threshold);
                if (null == result)
                {
                    result = FirstChild.LastEventWhenMore(to, threshold);
                }
                return(result);
            }
            Debug.Assert(null == FirstChild);
            Debug.Assert(null == SecondChild);
            if ((Close > threshold) && (Predicates.LessOrEqual(To, to)))
            {
                result = new KeyValuePair <Key, double>(To, Close);
            }
            else if (Open > threshold)
            {
                result = new KeyValuePair <Key, double>(From, Open);
            }
            return(result);
        }