Here is an example:
On 13 June an Entry Order was placed & triggered:
6/13/2014 9:00:00 AM Entered internal PlaceOrder() method at 6/13/2014 9:00:00 AM: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.4425 SignalName='BreakoutLong' FromEntrySignal=''
I do have this area that says, "Cancel the LongEntry order at 22:00 if it is not yet filled."
// Cancel Entry Orders if not filled by certain time
if (ToTime(Time[0]) >= ToTime(removeOrderHr, removeOrderMin,0)
&& LongEntry != null)
{
CancelOrder(LongEntry);
LongEntry = null;
}
I am attaching the updated code because I am not sure what other areas of the code could possibly be causing these to close like that.
Additionally, my stop & limit orders are being removed too soon.
The Output Window says they are being removed at inconsistent times despite the TIF being GTC. I have not written any code to cancel the Stop & Limit orders. Therefore they should not be cancelling unless the Entry Order is hit or when the trade closes out at a profit or a loss.
Here it says that they were cancelled at 10:00 AM

Comment