// Drawing is triggered here on a timer rather than in // CalcBar() because the bid and ask can change without CalcBar() // being called. protected override void OnRecalcLastBarAfterEvent() { if (Bars.DOM.Connected) { var _changed = false; // confusing logic; necessary because Bids/Asks will be null // on the first pass through. DOMPrice _old_ask = new DOMPrice(double.NaN, double.NaN); DOMPrice _old_bid = new DOMPrice(double.NaN, double.NaN); double _old_last = double.NaN; lock (this){ if (null == Asks) { _changed = true; } else { _old_ask = Asks[0]; _old_bid = Bids[0]; _old_last = LastPrice; } Asks = Bars.DOM.Ask; Bids = Bars.DOM.Bid; LastPrice = Bars.Close[0]; _changed = _changed || !((_old_ask == Asks[0]) && (_old_bid == Bids[0]) && (_old_last == LastPrice)); } _changed = _changed || !(LastPrice == Bars.Close[0]); if (_changed) { ChartCustomDraw.ReDraw(); } ExecControl.RecalcLastBarAfter(TimeSpan.FromSeconds(UpdateSpeedSecs)); } }
internal void SetDOM(DOMPrice ask, DOMPrice bid) { __cAsk = ask; __cBid = bid; }
private static bool equal(DOMPrice _1, DOMPrice _2) { return(_1.Size == _2.Size && _1.Price == _2.Price); }