can anybody help me with an example of how to close a position with code, I have looked at the documentation and online help and failed.
I am getting all long positions with this:
Code: Select all
var buyPositions = Positions[0].OpenTrades.Where(x => x.IsLong);
Code: Select all
foreach (var p in buyPositions)
{
OrderExit.FromEntry(p.EntryOrder);
PrintLoggingInfo("long position closed due to morning and afternoon sessions being closed.");
}
Regards,
Paul.