Strategy Objective:
I'm hoping for some direction on how to properly track a filled and sold order that was placed using the EnterLong(int quantity, string signalName) within my strategies OnExecution Method. (note, this has multiple quantities and the example in your help guide does not handle multiple quantities).
Problem:
I'm using EnterLong(int quantity, string signalName) to track IOrders in the OnExecutionMethod, there seems to be an issue with multiple quantities.
Failed Work Around:
Within the OnExecution Method, comparing the IOrder.Token to the captured IOrder execution.order.token fails because they are different guids.
Code:
The following code from the OnExecution HelpGuide does not work for multiple contracts . From http://www.ninjatrader.com/support/h...nexecution.htm
// Finding the executions of a particular IOrder object
private IOrder entryOrder = null;
private int entryQuantity = 8;
protected override void OnBarUpdate()
{
if (entryOrder == null && Close[0] > Open[0])
entryOrder = EnterLong(entryQuantity,"TestSignal");
}
protected override void OnExecution(IExecution execution)
{
if (entryOrder != null && entryOrder == execution.Order)
Print(execution.ToString());
}
I would appreciate any direction that comes to mind,
Thanks
Comment