コード例 #1
0
        internal static GraphPart CreateAsks(double requiredVolume, Quotes quotes)
        {
            GraphPart      result = new GraphPart(quotes);
            List <Point2F> points = result.m_points;
            long           now    = quotes.Time;

            foreach (var element in quotes.Items)
            {
                Point2F point = new Point2F();
                point.X = (element.Time - now) / 1000.0F;
                point.Y = MathEx.CalculateWAVP(requiredVolume, element.Quote.Asks);
                points.Add(point);
            }

            QuoteEx quote = quotes.Last;

            if (null != quote.Quote)
            {
                Point2F point = new Point2F();
                point.X = (quote.Time - now) / 1000.0F;
                if (point.X < -quotes.Interval)
                {
                    point.X = -(float)quotes.Interval;
                }
                point.Y = MathEx.CalculateWAVP(requiredVolume, quote.Quote.Asks);
                points.Add(point);
            }
            return(result);
        }
コード例 #2
0
        internal static GraphPart CreateBids(double requiredVolume, Quotes quotes)
        {
            GraphPart result = new GraphPart(quotes);
            List<Point2F> points = result.m_points;
            long now = quotes.Time;

            foreach (var element in quotes.Items)
            {
                Point2F point = new Point2F();
                point.X = (element.Time - now) / 1000.0F;
                point.Y = MathEx.CalculateWAVP(requiredVolume, element.Quote.Bids);
                points.Add(point);
            }

            if (0 == quotes.Items.Count)
            {
                quotes.Items.Clear();
            }

            QuoteEx quote = quotes.Last;
            if (null != quote.Quote)
            {
                Point2F point = new Point2F();
                point.X = (quote.Time - now) / 1000.0F;
                if (point.X < - quotes.Interval)
                {
                    point.X = -(float)quotes.Interval;
                }
                point.Y = MathEx.CalculateWAVP(requiredVolume, quote.Quote.Bids);
                points.Add(point);
            }
            return result;
        }
コード例 #3
0
        internal void DrawLineStraight(Pen pen, Point2F from, Point2F to)
        {
            if (from.Y.HasValue)
            {
                float xf = TransformX(from.X);
                float yf = TransformY(from.Y.Value);
                float xt = TransformX(to.X);

                m_graphics.DrawLine(pen, xf, yf, xt, yf);
            }
        }
コード例 #4
0
        internal void DrawLineInterpolation(Pen pen, Point2F from, Point2F to)
        {
            if (from.Y.HasValue && to.Y.HasValue)
            {
                float xf = TransformX(from.X);
                float yf = TransformY(from.Y.Value);
                float xt = TransformX(to.X);
                float yt = TransformY(to.Y.Value);

                m_graphics.DrawLine(pen, xf, yf, xt, yt);
            }
        }
コード例 #5
0
        internal void DrawLineInterpolation(Pen pen, Point2F from, Point2F to)
        {
            if (from.Y.HasValue && to.Y.HasValue)
            {
                float xf = TransformX(from.X);
                float yf = TransformY(from.Y.Value);
                float xt = TransformX(to.X);
                float yt = TransformY(to.Y.Value);

                m_graphics.DrawLine(pen, xf, yf, xt, yt);
            }
        }
コード例 #6
0
        internal void DrawInterpolation(GraphicsEx g, Pen pen)
        {
            var it = m_points.GetEnumerator();

            it.MoveNext();
            Point2F previous = it.Current;

            for (; it.MoveNext();)
            {
                Point2F next = it.Current;
                g.DrawLineInterpolation(pen, previous, next);
                previous = next;
            }
        }
コード例 #7
0
        internal void DrawStepped(GraphicsEx g, Pen pen)
        {
            var it = m_points.GetEnumerator();

            it.MoveNext();
            Point2F previous = it.Current;

            for (; it.MoveNext();)
            {
                Point2F next = it.Current;
                g.DrawLineStepped(pen, previous, next);
                previous = next;
            }
            if (m_points.Count > 0)
            {
                Point2F from = m_points.Last();
                Point2F to   = new Point2F(0, from.Y);
                g.DrawLineStepped(pen, from, to);
            }
        }
コード例 #8
0
        internal void DrawStraight(GraphicsEx g, Pen pen)
        {
            var it = m_points.GetEnumerator();
            it.MoveNext();
            Point2F previous = it.Current;

            for (; it.MoveNext(); )
            {
                Point2F next = it.Current;
                g.DrawLineStraight(pen, previous, next);
                previous = next;
            }
            if (m_points.Count > 0)
            {
                Point2F from = m_points.Last();
                Point2F to = new Point2F(0, from.Y);
                g.DrawLineStraight(pen, from, to);
            }
        }
コード例 #9
0
        internal void DrawLineStraight(Pen pen, Point2F from, Point2F to)
        {
            if (from.Y.HasValue)
            {
                float xf = TransformX(from.X);
                float yf = TransformY(from.Y.Value);
                float xt = TransformX(to.X);

                m_graphics.DrawLine(pen, xf, yf, xt, yf);
            }
        }