Exemple #1
0
        public void BidAndAskSizeDifference(Graphics graphics,
QuoteDataAtPrice theQuoteDataAtPrice, int Divisor, double
LargestValue)
        {
//
//                    if ((ToTime(Time[0]) < 9350) || (ToTime(Time[0]) > 15500))
//                      return;

                //Bid size ask size difference


                                         float scaledValue = (float) (
Math.Abs((theQuoteDataAtPrice.TotalBidSize -
theQuoteDataAtPrice.TotalAskSize) / Divisor)); //QQQ settings

                                        int tempLineThickness = 3;
//                                      if (( Math.Abs(theQuoteDataAtPrice.TotalBidSize -
theQuoteDataAtPrice.TotalAskSize) == LargestValue)
//                                              && ()
//                                              tempLineThickness = 3;
                double halfPoint = ((theQuoteDataAtPrice.High -
theQuoteDataAtPrice.Low) / 2) + theQuoteDataAtPrice.Low;

                tempLineThickness = 2;

                if (LargestValue == Math.Abs((theQuoteDataAtPrice.TotalBidSize -
theQuoteDataAtPrice.TotalAskSize)))
                        tempLineThickness = 3;

                        graphics.DrawLine(new Pen(Color.Red, tempLineThickness),
ChartControl.GetXByBarIdx(this.Bars,
theQuoteDataAtPrice.CurrentBarNumber ) ,
                                                ChartControl.GetYByValue(this.Bars, theQuoteDataAtPrice.Price),
                                                (ChartControl.GetXByBarIdx(this.Bars,
theQuoteDataAtPrice.CurrentBarNumber )) ,
                                                ChartControl.GetYByValue(this.Bars, theQuoteDataAtPrice.Price));

                                        if (theQuoteDataAtPrice.TotalBidSize > theQuoteDataAtPrice.TotalAskSize)
                                        {
                                                graphics.DrawLine(new Pen(Color.Red, tempLineThickness),
ChartControl.GetXByBarIdx(this.Bars,
theQuoteDataAtPrice.CurrentBarNumber ) ,
                                                ChartControl.GetYByValue(this.Bars, theQuoteDataAtPrice.Price),
                                                (ChartControl.GetXByBarIdx(this.Bars,
theQuoteDataAtPrice.CurrentBarNumber)) +  scaledValue ,
                                                ChartControl.GetYByValue(this.Bars, theQuoteDataAtPrice.Price));
                                        }
                                        else
                                        {
                                                graphics.DrawLine(new Pen(Color.Blue, tempLineThickness),
ChartControl.GetXByBarIdx(this.Bars,theQuoteDataAtPrice.CurrentBarNumber
) ,
                                                        ChartControl.GetYByValue(this.Bars, theQuoteDataAtPrice.Price),
                                                        (ChartControl.GetXByBarIdx(this.Bars,
theQuoteDataAtPrice.CurrentBarNumber )) + (scaledValue),
                                                        ChartControl.GetYByValue(this.Bars, theQuoteDataAtPrice.Price));
                                        }
        }
Exemple #2
0
                public void AddQuoteData(double thePrice, double theData, quote
theQuote, int theCurrentBar)
                {

                        if (BarDataCollection.Count == 0)
                                return;

                        SortedList<double, QuoteDataAtPrice> currentBarDataSL =
BarDataCollection[CurrentBar];

                        if ((currentBarDataSL != null) && currentBarDataSL.ContainsKey(thePrice))
                                {
                                        QuoteDataAtPrice theQuoteDataAtPrice = currentBarDataSL[thePrice];
                                        if (theQuote == quote.bid)
                                                theQuoteDataAtPrice.TotalBidSize += theData;
                                        else if (theQuote == quote.ask)
                                                theQuoteDataAtPrice.TotalAskSize += theData;
                                        else if (theQuote == quote.last)
                                                theQuoteDataAtPrice.TotalTradeSize += theData;
                                        else if (theQuote == quote.lastAtBid)
                                                theQuoteDataAtPrice.TotalTradeSizeAtBid += theData;
                                        else if (theQuote == quote.lastAtAsk)
                                                theQuoteDataAtPrice.TotalTradeSizeAtAsk += theData;
                                        else if (theQuote == quote.drift)
                                                theQuoteDataAtPrice.Drift += theData;


                                        theQuoteDataAtPrice.CurrentBarNumber = theCurrentBar;
                                        theQuoteDataAtPrice.Price = thePrice;
                                        theQuoteDataAtPrice.High = High[0];
                                        theQuoteDataAtPrice.Low = Low[0];
                                }
                                else
                                {
                                        QuoteDataAtPrice theQuoteDataAtPrice = new QuoteDataAtPrice();
                                        if (theQuote == quote.bid)
                                                theQuoteDataAtPrice.TotalBidSize += theData;
                                        else if (theQuote == quote.ask)
                                                theQuoteDataAtPrice.TotalAskSize += theData;
                                        else if (theQuote == quote.last)
                                                theQuoteDataAtPrice.TotalTradeSize += theData;
                                        else if (theQuote == quote.lastAtBid)
                                                theQuoteDataAtPrice.TotalTradeSizeAtBid += theData;
                                        else if (theQuote == quote.lastAtAsk)
                                                theQuoteDataAtPrice.TotalTradeSizeAtAsk += theData;
                                        else if (theQuote == quote.drift)
                                                theQuoteDataAtPrice.Drift += theData;

                                        theQuoteDataAtPrice.CurrentBarNumber = theCurrentBar;
                                        theQuoteDataAtPrice.Price = thePrice;
                                        theQuoteDataAtPrice.High = High[0];
                                        theQuoteDataAtPrice.Low = Low[0];
                                        currentBarDataSL.Add(thePrice, theQuoteDataAtPrice);
                                }
                }