it works fine for the strategy. When I disable the Strategy, the position is flattened.
But, I did some debugging and it is also the cause of a bug where my changes when I choose "Edit Strategy" from the Strategies tab are lost. I cannot change any properties of a strategy with Edit Strategy unless I comment out this code.
So I'm wondering what I need to do to make it safe for Edit Strategy
My code is :
else if (State == State.Terminated) {
// instantiate a list of instruments
Collection<Cbi.Instrument> instrumentsToCancel = new Collection<Instrument>();
// add instruments to the collection
instrumentsToCancel.Add(Instrument);
// pass the instrument collection to the Flatten() method to be flattened
Account.Flatten(instrumentsToCancel);
}
Comment