public double Execute(ISecurity sec, int barNum) { var qds = Buy ? sec.GetBuyQueue(0) : sec.GetSellQueue(0); if (qds?.Count > 0 && Index >= 0 && qds.Count > Index) { var qd = qds[Index]; return(qd?.Price ?? 0.0); } return(0d); }
public double Execute(ISecurity sec, int barNum) { if (NumberRows > 0) { var qds = Buy ? sec.GetBuyQueue(0) : sec.GetSellQueue(0); if (qds?.Count > 0) { var cnt = qds.Count > NumberRows ? NumberRows : qds.Count; double total = 0d; for (int i = 0; i < cnt; i++) { var qd = qds[i]; total += qd.Quantity; } return(total); } } return(0d); }