I'm using an unmanaged approach. I've looked at the reference sample for SampleMonitorStopProfit:
http://www.ninjatrader.com/support/f...ead.php?t=5790 which contains this portion in OnOrderUpdate:
protectedoverridevoid OnOrderUpdate(IOrder order)
{
// If OnOrderUpdate() is called from a stop loss or profit target order add it to the appropriate collection
if (order.OrderState == OrderState.PendingSubmit)
{
// Add the "Stop loss" orders to the Stop Loss collection
if (order.Name == "Stop loss")
stopLossOrders.Add(order);
protectedoverridevoid OnExecution(IExecution execution)
{
/* We advise monitoring OnExecution to trigger submission of stop/target orders instead of OnOrderUpdate() since OnExecution() is called after OnOrderUpdate()
which ensures your strategy has received the execution which is used for internal signal tracking. */
if (entryOrder != null && entryOrder == execution.Order)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
// Stop-Loss order 4 ticks below our entry price
stopOrder = ExitLongStop(0, true, execution.Order.Filled, execution.Order.AvgFillPrice - 4 * TickSize, "MyStop", "MyEntry");
Is the use of
stopLossOrders.Add(order);
Comment