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; }
internal ChartState(Parameters parameters, Quotes quotes) { m_parameters = parameters; m_quotes = quotes; this.Graphs = new List<Graph>(); this.XPhysicalDashes = new List<PointF>(); this.YPhysicalDashes = new List<PointF>(); }
internal static string Format(double lotSize,double roundingStepOfPrice, IEnumerable<double> volumes, Quotes quotes) { StringBuilder builder = new StringBuilder(); WriteHeader(volumes, builder); foreach (var element in quotes.Items) { WriteQuote(lotSize, roundingStepOfPrice, volumes, element, quotes.Time, builder); } string result = builder.ToString(); return result; }
internal void Update(Parameters parameters, ChartSettings settings, Quotes quotes) { if (m_grid.BackgroundColor != settings.BackgroundColor) { m_grid.BackgroundColor = settings.BackgroundColor; } Quote quote = quotes.Last.Quote; int count = (null == quote) ? 0 : settings.Lines.Count; Update(count); for (int index = 0; index < count; ++index ) { LineSettings line = settings.Lines[index]; Color volumeColor = CalculateColor(line.BidColor, line.AskColor, settings.ForegroundColor); Update(settings, index, 0, (float)line.Volume, volumeColor); double volume = line.Volume * parameters.LotSize; float? bid = MathEx.CalculateWAVP(volume, quote.Bids); float? ask = MathEx.CalculateWAVP(volume, quote.Asks); if (bid.HasValue) { bid = (float)MathEx.RoundDown(bid.Value, parameters.PricePip); } if (ask.HasValue) { ask = (float)MathEx.RoundUp(ask.Value, parameters.PricePip); } Update(settings, index, 1, bid, line.BidColor); Update(settings, index, 2, ask, line.AskColor); float? spread = null; if (bid.HasValue && ask.HasValue) { spread = (float)Math.Round(parameters.PriceFactor * (ask.Value - bid.Value)); } Color spreadColor = CalculateColor(line.BidColor, line.AskColor, settings.ForegroundColor); Update(settings, index, 3, spread, spreadColor); } Size size = m_grid.PreferredSize; if (this.Size != size) { this.Size = size; } //if (!this.Visible) //{ // this.Visible = true; //} }
private GraphPart(Quotes quotes) { m_points.Capacity = 1 + quotes.Items.Count; }
internal static string Format(double lotSize, double roundingStepOfPrice, IEnumerable <double> volumes, Quotes quotes) { StringBuilder builder = new StringBuilder(); WriteHeader(volumes, builder); foreach (var element in quotes.Items) { WriteQuote(lotSize, roundingStepOfPrice, volumes, element, quotes.Time, builder); } string result = builder.ToString(); return(result); }
internal Graph(double requiredVolume, Quotes quotes) { m_bids = GraphPart.CreateBids(requiredVolume, quotes); m_asks = GraphPart.CreateAsks(requiredVolume, quotes); }