Esempio n. 1
0
        void SetDiff(int index1)
        {
            if (hd2 == null || hd1 == null)
            {
                return;
            }

            var time1  = hd1.GetTimeUtc(index1);
            var index2 = hd2.FindInterval(time1);

            if (index2 < 0)
            {
                return;
            }

            var open  = hd1.GetValue(PriceType.Open, index1) - hd2.GetValue(PriceType.Open, index2);
            var close = hd1.GetValue(PriceType.Close, index1) - hd2.GetValue(PriceType.Close, index2);
            var high  = hd1.GetValue(PriceType.High, index1) - hd2.GetValue(PriceType.High, index2);
            var low   = hd1.GetValue(PriceType.Low, index1) - hd2.GetValue(PriceType.Low, index2);

            var min = Math.Min(open, close);
            var max = Math.Max(open, close);

            if (low > min)
            {
                low = min;
            }

            if (high < max)
            {
                high = max;
            }

            Lines["Open"].SetValue(open, index1);
            Lines["High"].SetValue(high, index1);
            Lines["Low"].SetValue(low, index1);
            Lines["Close"].SetValue(close, index1);
        }