I am having a problem after submitting simulated stop orders in ChartTrader, and working with those orders in OnOrderUpdate. The OrderType shows up as Limit orders instead of StopMarket or StopLimit. Here is the summarized logic of my code:
private void OnOrderUpdate(object sender, OrderEventArgs e) { foreach(Order order in account.Orders) { if ((order.OrderState == OrderState.Working) || (order.OrderState == OrderState.Accepted) || (order.OrderState == OrderState.TriggerPending)) { if (order.OrderType == OrderType.Limit) { ProfitValue += (order.LimitPrice * order.Quantity); } // when Order State = TriggerPending, the following if statement is never true, instead the OrderType is listed as LIMIT (Debugging in VB) if ((order.OrderType == OrderType.StopMarket) || (order.OrderType == OrderType.StopLimit)) { StopValue += (order.StopPrice * order.Quantity); StopQty += order.Quantity; } } } }
Comment