protected override void OnBarUpdate()
{
if (entryOrder == null && Close[0] > Open[0])
[SIZE=2] entryOrder = EnterLongLimit(GetNumSharesToBuyViaAccountSize(Close[0]), Instrument.FullName);[/SIZE]
}
protected override void OnExecution(IExecution execution) {
if (entryOrder != null && entryOrder == execution.Order) {
Print(execution.ToString());
entryOrder = null;
}
}
protected override void OnOrderUpdate(IOrder order) {
if (entryOrder != null && entryOrder == order) {
Print(order.ToString());
if (order.OrderState == OrderState.Filled)
entryOrder = null;
}
}
Does it make a difference weather I use OnExecution or OnOrderUpdate for gathering this information?
For the partial fill case will OnOrderUpdate and/or OnExecution get called mutiple times with
OrderState.PartFilled and then one final time with
OrderState.Filled or do I just agregate the values when I get OrderState.PartFilled?
I will be using MB Trading so how does this effect the code:
MB Trading position events are generated before orders are executed. Since NinjaTrader relies on execution events to come prior to position events, you will experience limitations with tracking positions from the Strategies tab of the Control Center and trying to rely on the standard sequence of events (order execution before position) in NinjaScript.
Erik

Comment