I am using the following code technique with an unmanaged appraoch:
.
entryOrder = SubmitOrder(......);
.
exitOrder = SubmitOrder(......);
.
protected override void OnExecution(IExecution execution)
{
if (entryOrder != null && entryOrder == execution.Order)
set some variables
.
if (exitOrder != null && exitOrder == execution.Order)
reset some variables
.
}
There is no problem when entry and exit are within a session.
But, if the entry was made in a prior session, the exitOrder object will never match the execution.Order object, and so the variables are not reset.

Comment